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
changes/95/21095/3
Alexander Lutay 8 years ago
parent 1f35eb3e42
commit 7dbeda8733

@ -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=<client-ip:<srv-ip>:..." boot arg
if checkBootParam ip ; then
declare -A IP_ARR

Loading…
Cancel
Save