mirror of
https://github.com/thelittlerocket/pve.git
synced 2024-11-15 19:44:38 +08:00
Update install_pve.sh
This commit is contained in:
parent
dd9bb301a1
commit
d28cf06b41
1 changed files with 5 additions and 2 deletions
|
@ -46,6 +46,7 @@ fi
|
||||||
ip=$(curl -s ipv4.ip.sb)
|
ip=$(curl -s ipv4.ip.sb)
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
if [ "${hostname}" != "pve" ]; then
|
if [ "${hostname}" != "pve" ]; then
|
||||||
|
chattr -i /etc/hosts
|
||||||
hosts=$(grep -E "^[^#]*\s+${hostname}\s+${hostname}\$" /etc/hosts | grep -v "${ip}")
|
hosts=$(grep -E "^[^#]*\s+${hostname}\s+${hostname}\$" /etc/hosts | grep -v "${ip}")
|
||||||
if [ -n "${hosts}" ]; then
|
if [ -n "${hosts}" ]; then
|
||||||
# 注释掉查询到的行
|
# 注释掉查询到的行
|
||||||
|
@ -75,7 +76,7 @@ if [ "${hostname}" != "pve" ]; then
|
||||||
# echo "${ip} pve.proxmox.com pve" >> /etc/hosts
|
# echo "${ip} pve.proxmox.com pve" >> /etc/hosts
|
||||||
# echo "Added ${ip} pve.proxmox.com pve to /etc/hosts"
|
# echo "Added ${ip} pve.proxmox.com pve to /etc/hosts"
|
||||||
# fi
|
# fi
|
||||||
sudo chattr +i /etc/hosts
|
chattr +i /etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## ChinaIP检测
|
## ChinaIP检测
|
||||||
|
@ -214,6 +215,7 @@ if grep -q "source /etc/network/interfaces.d/*" /etc/network/interfaces; then
|
||||||
ipv4=$(echo $eth0info | cut -d'/' -f1)
|
ipv4=$(echo $eth0info | cut -d'/' -f1)
|
||||||
subnet=$(echo $eth0info | cut -d'/' -f2)
|
subnet=$(echo $eth0info | cut -d'/' -f2)
|
||||||
subnet=$(ipcalc -n "$ipv4/$subnet" | grep -oP 'Netmask:\s+\K.*' | awk '{print $1}')
|
subnet=$(ipcalc -n "$ipv4/$subnet" | grep -oP 'Netmask:\s+\K.*' | awk '{print $1}')
|
||||||
|
chattr -i /etc/network/interfaces.d/50-cloud-init
|
||||||
sed -i "/iface eth0 inet dhcp/c\
|
sed -i "/iface eth0 inet dhcp/c\
|
||||||
iface eth0 inet static\n\
|
iface eth0 inet static\n\
|
||||||
address $ipv4\n\
|
address $ipv4\n\
|
||||||
|
@ -227,8 +229,9 @@ fi
|
||||||
systemctl restart networking
|
systemctl restart networking
|
||||||
if [ ! -s "/etc/resolv.conf" ]
|
if [ ! -s "/etc/resolv.conf" ]
|
||||||
then
|
then
|
||||||
|
chattr -i /etc/resolv.conf
|
||||||
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
|
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
|
||||||
sudo chattr +i /etc/resolv.conf
|
chattr +i /etc/resolv.conf
|
||||||
fi
|
fi
|
||||||
# 打印安装后的信息
|
# 打印安装后的信息
|
||||||
url="https://${ip}:8006/"
|
url="https://${ip}:8006/"
|
||||||
|
|
Loading…
Reference in a new issue