From 2549a41eb3b14f9f90877be9c2af1e87d8a8ea32 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Wed, 6 Jan 2016 16:51:58 +0100 Subject: [PATCH] Add a valid hostname entry in /etc/hosts if not found Using 127.0.1.1 as per http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution --- installer.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/installer.sh b/installer.sh index 5d364930e..b001e44ab 100755 --- a/installer.sh +++ b/installer.sh @@ -29,6 +29,23 @@ readonly installer_code_file="/root/installer.tar" readonly installer_tmp_dir="/tmp/installer" readonly cert_folder="/tmp/certificates" +# check for fqdn in /ets/hosts +echo "[INFO] checking for hostname entry" +readonly hostentry_found=$(grep "${fqdn}" /etc/hosts || true) +if [[ -z $hostentry_found ]]; then + echo "[WARNING] No entry for ${fqdn} found in /etc/hosts" + echo "Adding an entry ..." + + cat >> /etc/hosts <