mirror of
https://github.com/thelittlerocket/pve.git
synced 2024-11-15 19:44:38 +08:00
Update build_nat_network.sh
This commit is contained in:
parent
66e4287912
commit
69c807e164
1 changed files with 10 additions and 9 deletions
|
@ -52,16 +52,17 @@ fi
|
||||||
if [ -f /etc/network/interfaces ]; then
|
if [ -f /etc/network/interfaces ]; then
|
||||||
cp /etc/network/interfaces /etc/network/interfaces.bak
|
cp /etc/network/interfaces /etc/network/interfaces.bak
|
||||||
fi
|
fi
|
||||||
interfaces_file=""
|
interfaces_file="/etc/network/interfaces"
|
||||||
if [ -f /etc/network/interfaces.d/50-cloud-init ] && [ -f /etc/network/interfaces ]; then
|
|
||||||
if grep -q "source /etc/network/interfaces.d/*" /etc/network/interfaces; then
|
|
||||||
interfaces_file="/etc/network/interfaces.d/50-cloud-init"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -z "$interfaces_file" ]; then
|
|
||||||
interfaces_file="/etc/network/interfaces"
|
|
||||||
fi
|
|
||||||
chattr -i "$interfaces_file"
|
chattr -i "$interfaces_file"
|
||||||
|
# if ! grep -q "auto lo" "$interfaces_file"; then
|
||||||
|
# echo "auto lo" >> "$interfaces_file"
|
||||||
|
# fi
|
||||||
|
# if ! grep -q "iface lo inet loopback" "$interfaces_file"; then
|
||||||
|
# echo "iface lo inet loopback" >> "$interfaces_file"
|
||||||
|
# fi
|
||||||
|
if ! grep -q "iface ${interface} inet manual" "$interfaces_file"; then
|
||||||
|
echo "iface ${interface} inet manual" >> "$interfaces_file"
|
||||||
|
fi
|
||||||
if grep -q "vmbr0" "$interfaces_file"; then
|
if grep -q "vmbr0" "$interfaces_file"; then
|
||||||
echo "vmbr0 已存在在 ${interfaces_file}"
|
echo "vmbr0 已存在在 ${interfaces_file}"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue