Update install_pve.sh

This commit is contained in:
spiritlhl 2023-07-31 12:17:05 +08:00 committed by GitHub
parent 77127a7f9f
commit 255f7ffee3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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