From 44f6d5577447ee3d8dc41d107642591cc3c2107f Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Fri, 23 Jun 2023 05:34:27 +0000 Subject: [PATCH] Update --- scripts/install_pve.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index 5b44782..ec0a6e3 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -103,12 +103,6 @@ if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then cp -f /etc/network/interfaces.new /etc/network/interfaces chattr +i /etc/network/interfaces fi -chattr -i /etc/network/interfaces -sed -i '/source \/etc\/network\/interfaces\.d\/*/{s/^/#/}' "/etc/network/interfaces" -chattr +i /etc/network/interfaces -chattr -i /etc/network/interfaces.new -sed -i '/source \/etc\/network\/interfaces\.d\/*/{s/^/#/}' "/etc/network/interfaces.new" -chattr +i /etc/network/interfaces.new # 合并文件 if [[ -f "/etc/network/interfaces.d/50-cloud-init" && -f "/etc/network/interfaces" ]]; then if [[ ! -f "/etc/network/interfaces" ]]; then @@ -119,6 +113,23 @@ if [[ -f "/etc/network/interfaces.d/50-cloud-init" && -f "/etc/network/interface rm /etc/network/interfaces.d/50-cloud-init chattr +i /etc/network/interfaces fi +# 去除引用 +if [[ -f "/etc/network/interfaces" ]]; then + chattr -i /etc/network/interfaces + sed -i '/source \/etc\/network\/interfaces\.d\/*/{s/^/#/}' "/etc/network/interfaces" + chattr +i /etc/network/interfaces +fi +if [[ -f "/etc/network/interfaces.new" ]]; then + chattr -i /etc/network/interfaces.new + sed -i '/source \/etc\/network\/interfaces\.d\/*/{s/^/#/}' "/etc/network/interfaces.new" + chattr +i /etc/network/interfaces.new +fi +# 反加载 +if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then + chattr -i /etc/network/interfaces + cp -f /etc/network/interfaces /etc/network/interfaces.new + chattr +i /etc/network/interfaces +fi # 允许手动配置 # if ! grep -q "iface ${interface} inet manual" "/etc/network/interfaces"; then # chattr -i /etc/network/interfaces