From 1b8adb069d7165e7446c3c8a3a22b97eba986338 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 13 Jun 2024 16:16:19 +0100 Subject: [PATCH] Do not add hosts entries for files on vvv_update_guest_hosts if the domain is already present --- provision/provision-helpers.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index dc9c881d8..9822ca767 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -665,7 +665,10 @@ function vvv_update_guest_hosts() { local value value=$(shyaml -q get-values "sites.${SITE_ESCAPED}.hosts" <${VVV_CONFIG}) for v in $value; do - echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}" >> /tmp/site-hosts + if [[ -z "$(grep -q "^127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}$" /etc/hosts)" ]]; then + echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/hosts" + echo "::1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/hosts" + fi done done