From 7dbeda8733c41671ffedef3bf60fdabe9bba7177 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Mon, 7 May 2018 18:24:56 +0200 Subject: [PATCH] TT#36454 Move HOSTNAME definition after boot parameters loading section Exporting HOSTNAME inside the loading 'boot parameters' section causes the following issue (inside GRML chroot): > (sp1)root@sp1:/# hostname --fqdn > hostname: Name or service not known NOTE: it happens if ngcphostname is not defined. We should separate loading options and using them to have clear system behaviour, so we move the export code forward. In this case TARGET_HOSTNAME will be defined from options ngcpsp1/ngcpsp2 and 'export HOSTNAME="$TARGET_HOSTNAME"' will do the job even if ngcphostname is not defined. We should consider deprecating/removing 'ngcphostname' completely if possible, as currently the option description is a bit confusing: > ngcphostname=... - hostname of installed system (defaults to ngcp/sp[1,2]) > NOTE: do NOT use when installing Pro Edition! (which says we should not use it on PRO, while PRO installation cannot happens without ngcphostname option). AFAIK, it is necessary for Carrier only, to define Carrier host name, like web01a. Change-Id: Idba31fd8286d41bd0c1aaf7ee762371e6b1d50d5 --- templates/scripts/includes/deployment.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index 6dcf3a1..406ef79 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -487,13 +487,6 @@ if checkBootParam ngcphostname ; then TARGET_HOSTNAME="$(getBootParam ngcphostname)" || true fi -if [ -n "$TARGET_HOSTNAME" ] ; then - export HOSTNAME="$TARGET_HOSTNAME" -else - [ -n "$HOSTNAME" ] || HOSTNAME="nohostname" - export HOSTNAME -fi - if checkBootParam ngcpip1 ; then IP1=$(getBootParam ngcpip1) fi @@ -792,6 +785,12 @@ if [ -z "$TARGET_HOSTNAME" ] ; then fi fi +[ -z "$HOSTNAME" ] && HOSTNAME="nohostname" +if [ -n "$TARGET_HOSTNAME" ] ; then + HOSTNAME="$TARGET_HOSTNAME" +fi +export HOSTNAME + # get install device from "ip=:..." boot arg if checkBootParam ip ; then declare -A IP_ARR