Files
bird_config/update.sh
2025-11-02 13:31:21 +08:00

33 lines
878 B
Bash

#!/bin/bash
rm /etc/bird/conf/dn42.conf
rm /etc/bird/function/dn42.conf
rm /etc/bird/net/dn42.conf
rm /etc/bird/function/unet.conf
curl https://git.nia.ink/brnet/bird_config/raw/branch/master/bird/function/unet.conf > /etc/bird/function/unet.conf
rm /etc/bird/bird.conf
curl https://git.nia.ink/brnet/bird_config/raw/branch/master/bird/bird.conf > /etc/bird/bird.conf
temp_file=$(mktemp)
awk '
BEGIN { delete_dn42 = 0 }
/^define DN42_ASN/ { delete_dn42 = 1 }
delete_dn42 == 0 { print $0 }
/^define UNET_ASN/ { delete_dn42 = 0; print $0 }
' /etc/bird/vars.conf > "$temp_file"
if [ -s "$temp_file" ]; then
mv "$temp_file" /etc/bird/vars.conf
echo "已成功删除 /etc/bird/vars.conf 中的DN42配置部分"
else
echo "处理出错,临时文件为空,未修改原文件"
rm "$temp_file"
fi
chmod -R 755 /etc/bird
birdc c
cd
rm update.sh