Update install_pve.sh

This commit is contained in:
spiritLHLS 2023-05-12 10:02:40 +08:00 committed by GitHub
parent 9e6d4df3af
commit bf501e2ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,6 +78,16 @@ cdn_urls=("https://cdn.spiritlhl.workers.dev/" "https://shrill-pond-3e81.hunsh.w
check_cdn_file
# /etc/hosts文件修改
if [ -f "/etc/cloud/cloud.cfg" ]; then
if grep -q "preserve_hostname: false" "/etc/cloud/cloud.cfg"; then
sed -i 's/preserve_hostname: false/preserve_hostname: true/g' "/etc/cloud/cloud.cfg"
echo "change preserve_hostname to true"
else
echo "preserve_hostname is true"
fi
else
echo "can not find /etc/cloud/cloud.cfg"
fi
ip=$(curl -s ipv4.ip.sb)
hostname=$(hostname)
if [ "${hostname}" != "pve" ]; then
@ -113,16 +123,6 @@ if [ "${hostname}" != "pve" ]; then
# fi
chattr +i /etc/hosts
fi
if [ -f "/etc/cloud/cloud.cfg" ]; then
if grep -q "preserve_hostname: false" "/etc/cloud/cloud.cfg"; then
sed -i 's/preserve_hostname: false/preserve_hostname: true/g' "/etc/cloud/cloud.cfg"
echo "change preserve_hostname to true"
else
echo "preserve_hostname is true"
fi
else
echo "can not find /etc/cloud/cloud.cfg"
fi
## ChinaIP检测
if [[ -z "${CN}" ]]; then