From 255f7ffee30c8c8d37b12b98f3754f59b2b5d2fb Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:17:05 +0800 Subject: [PATCH] Update install_pve.sh --- scripts/install_pve.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index 9205a41..0f1283e 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -290,6 +290,19 @@ if [ -f "/etc/network/interfaces" ]; then fi chattr +i /etc/network/interfaces fi +# 检测回环是否存在 +if ! grep -q "auto lo" "/etc/network/interfaces"; then + chattr -i /etc/network/interfaces + echo "auto lo" >> "/etc/network/interfaces" + chattr +i /etc/network/interfaces + _blue "Can not find 'auto lo' in /etc/network/interfaces, add it" +fi +if ! grep -q "iface lo inet loopback" "/etc/network/interfaces"; then + chattr -i /etc/network/interfaces + echo "iface lo inet loopback" >> "/etc/network/interfaces" + chattr +i /etc/network/interfaces + _blue "Can not find 'iface lo inet loopback' in /etc/network/interfaces, add it" +fi # 反加载 if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then chattr -i /etc/network/interfaces.new