From 695fb818931eb817fb0e511975032d508d015e0b Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 31 Jul 2023 21:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=89=A9=E7=90=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=98=AF=E5=90=A6=E5=B7=B2auto=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检测物理接口是否已auto链接 --- scripts/install_pve.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index 24ddf65..638234c 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -310,6 +310,12 @@ if [[ $dmidecode_output == *"Hetzner_vServer"* ]] || [[ $dmidecode_output == *"M chattr +i /etc/network/interfaces fi fi +# 检测物理接口是否已auto链接 +if ! grep -q "auto ${interface}" /etc/network/interfaces; then + chattr -i /etc/network/interfaces + echo "auto ${interface}" >> /etc/network/interfaces + chattr +i /etc/network/interfaces +fi # 反加载 if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then chattr -i /etc/network/interfaces.new