Update install_pve.sh

This commit is contained in:
spiritlhl 2023-05-28 17:42:38 +08:00 committed by GitHub
parent ef8f4499ef
commit c199d3a23f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,16 +110,7 @@ fi
rebuild_cloud_init
# 检测IPV4
API_NET=("ip.sb" "ipget.net" "ip.ping0.cc" "https://ip4.seeip.org" "https://api.my-ip.io/ip" "https://ipv4.icanhazip.com" "api.ipify.org")
for p in "${API_NET[@]}"; do
response=$(curl -s4m8 "$p")
sleep 1
if [ $? -eq 0 ] && ! echo "$response" | grep -q "error"; then
IP_API="$p"
break
fi
done
ip=$(curl -s4m6 "$IP_API")
ip=$(ip -4 addr show | grep global | awk 'NR==1{print $2}' | cut -d '/' -f1)
# /etc/hosts文件修改
hostname=$(hostname)