From 7676edfa05caed098880c0923eaab072709abdc5 Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 4 Apr 2023 10:49:39 +0800 Subject: [PATCH] Update install_pve.sh --- install_pve.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install_pve.sh b/install_pve.sh index ad12c98..321e527 100644 --- a/install_pve.sh +++ b/install_pve.sh @@ -58,7 +58,11 @@ if [ "${hostname}" != "pve" ]; then fi fi 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 "Added 127.0.0.1 localhost.localdomain localhost to /etc/hosts" fi