Răsfoiți Sursa

fix: prevent /etc/hosts domain duplication

Ivan Augusto 3 ani în urmă
părinte
comite
2b4dd30bbc
1 a modificat fișierele cu 4 adăugiri și 2 ștergeri
  1. 4 2
      compose/bin/setup-domain

+ 4 - 2
compose/bin/setup-domain

@@ -5,8 +5,10 @@ set -o errexit
 
 DOMAIN=$1
 
-echo "Your system password has been requested to add an entry to /etc/hosts..."
-echo "127.0.0.1 ::1 $DOMAIN" | sudo tee -a /etc/hosts
+if ! grep -q $DOMAIN /etc/hosts; then
+    echo "Your system password is needed to add an entry to /etc/hosts..."
+    echo "127.0.0.1 ::1 $DOMAIN" | sudo tee -a /etc/hosts
+fi
 
 echo "Set https://${DOMAIN}/ to web/secure/base_url and web/secure/base_url"
 bin/clinotty bin/magento config:set web/secure/base_url https://"$DOMAIN"/