Update install_pve7.sh

This commit is contained in:
spiritLHLS 2023-02-13 22:57:18 +08:00 committed by GitHub
parent 0553e2fc81
commit b6ca413bfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,9 +29,10 @@ file_path="/etc/hosts"
while read line; do while read line; do
if [[ "$line" =~ ^127\.0\.0\.1.* ]]; then if [[ "$line" =~ ^127\.0\.0\.1.* ]]; then
host=($(echo "$line" | awk '{print $2, $3, $4}')) host=($(echo "$line" | awk '{print $2, $3, $4}'))
host2="127.0.0.1 ${host[1]}" host2="127.0.0.1 ${host[0]}"
host3="127.0.0.1 ${host[2]}" host3="127.0.0.1 ${host[1]}"
sed -i "s/$line/$host2\n$host3/g" $file_path sed -i "s/$line/$host2\n$host3/g" $file_path
break
fi fi
done < $file_path done < $file_path
hostname=$(cat /etc/hostname) hostname=$(cat /etc/hostname)
@ -54,6 +55,7 @@ if [ -e "/etc/cloud/templates/hosts.debian.tmpl" ]; then
host2="127.0.0.1 ${host[1]}" host2="127.0.0.1 ${host[1]}"
host3="127.0.0.1 ${host[2]}" host3="127.0.0.1 ${host[2]}"
sed -i "s/$line/$host2\n$host3/g" $file_path sed -i "s/$line/$host2\n$host3/g" $file_path
break
fi fi
done < $file_path done < $file_path
hostname=$(cat /etc/hostname) hostname=$(cat /etc/hostname)