mirror of
https://github.com/oneclickvirt/pve.git
synced 2024-11-10 17:25:50 +08:00
update
This commit is contained in:
parent
3c38424f79
commit
1fb30fc119
2 changed files with 24 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
- 开设独立IPV4地址的虚拟机时,尝试增加自动附加IPV6地址的功能
|
- 开设独立IPV4地址的虚拟机时,尝试增加自动附加IPV6地址的功能
|
||||||
- 增加一键开设纯IPV6虚拟机、纯IPV6容器的脚本
|
- 增加一键开设纯IPV6虚拟机、纯IPV6容器的脚本
|
||||||
|
- 修复可能的dns-nameservers存在多行导致网络异常的问题
|
||||||
|
|
||||||
[更新日志](CHANGELOG.md)
|
[更新日志](CHANGELOG.md)
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,9 @@ if ! grep -q "iface lo inet loopback" "/etc/network/interfaces"; then
|
||||||
chattr +i /etc/network/interfaces
|
chattr +i /etc/network/interfaces
|
||||||
_blue "Can not find 'iface lo inet loopback' in /etc/network/interfaces, add it"
|
_blue "Can not find 'iface lo inet loopback' in /etc/network/interfaces, add it"
|
||||||
fi
|
fi
|
||||||
|
chattr -i /etc/network/interfaces
|
||||||
|
echo " " >> /etc/network/interfaces
|
||||||
|
chattr +i /etc/network/interfaces
|
||||||
# 合并文件
|
# 合并文件
|
||||||
if [ -d "/etc/network/interfaces.d/" ]; then
|
if [ -d "/etc/network/interfaces.d/" ]; then
|
||||||
if [ ! -f "/etc/network/interfaces" ]; then
|
if [ ! -f "/etc/network/interfaces" ]; then
|
||||||
|
@ -338,6 +341,26 @@ if ! grep -q "auto ${interface}" /etc/network/interfaces; then
|
||||||
echo "auto ${interface}" >> /etc/network/interfaces
|
echo "auto ${interface}" >> /etc/network/interfaces
|
||||||
chattr +i /etc/network/interfaces
|
chattr +i /etc/network/interfaces
|
||||||
fi
|
fi
|
||||||
|
# 删除可能的多个dns-nameservers的行只保留一行
|
||||||
|
dns_lines=$(grep -c "dns-nameservers" /etc/network/interfaces)
|
||||||
|
if [ $dns_lines -gt 1 ]; then
|
||||||
|
rm -rf /tmp/interfaces.tmp
|
||||||
|
original_lines=$(wc -l < /etc/network/interfaces)
|
||||||
|
current_dns_lines=0
|
||||||
|
while read -r line; do
|
||||||
|
if echo "$line" | grep -q "dns-nameservers"; then
|
||||||
|
current_dns_lines=$((current_dns_lines + 1))
|
||||||
|
if [ $current_dns_lines -lt $dns_lines ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "$line" >> /tmp/interfaces.tmp
|
||||||
|
done < /etc/network/interfaces
|
||||||
|
chattr -i /etc/network/interfaces
|
||||||
|
mv /tmp/interfaces.tmp /etc/network/interfaces
|
||||||
|
chattr +i /etc/network/interfaces
|
||||||
|
rm -rf /tmp/interfaces.tmp
|
||||||
|
fi
|
||||||
# 反加载
|
# 反加载
|
||||||
if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then
|
if [[ -f "/etc/network/interfaces.new" && -f "/etc/network/interfaces" ]]; then
|
||||||
chattr -i /etc/network/interfaces.new
|
chattr -i /etc/network/interfaces.new
|
||||||
|
|
Loading…
Reference in a new issue