Update install_pve.sh

This commit is contained in:
spiritLHLS 2023-04-04 10:49:39 +08:00 committed by GitHub
parent 81e0dafce5
commit 7676edfa05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,11 @@ if [ "${hostname}" != "pve" ]; then
fi fi
fi fi
hostnamectl set-hostname pve hostnamectl set-hostname pve
if ! grep -q "127.0.0.1 localhost.localdomain localhost" /etc/hosts; then if grep -q "^127\.0\.0\.1 localhost$" /etc/hosts; then
sed -i '/^127\.0\.0\.1 localhost$/ s/^/#/' /etc/hosts
echo "Commented out 127.0.0.1 localhost in /etc/hosts"
fi
if ! grep -q "^127\.0\.0\.1 localhost\.localdomain localhost$" /etc/hosts; then
echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
echo "Added 127.0.0.1 localhost.localdomain localhost to /etc/hosts" echo "Added 127.0.0.1 localhost.localdomain localhost to /etc/hosts"
fi fi