diff options
author | Jonathan Bauer | 2019-08-27 14:07:35 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-08-27 14:07:35 +0200 |
commit | f63748cd80a7250d0f6b03e00fdf1af9c7b321b3 (patch) | |
tree | 65f5c5a9810a5087b1b3dc5fee9b96643603a8b4 | |
parent | [slx-dmsetup] fix small ID44 / large filesystem (diff) | |
download | systemd-init-f63748cd80a7250d0f6b03e00fdf1af9c7b321b3.tar.gz systemd-init-f63748cd80a7250d0f6b03e00fdf1af9c7b321b3.tar.xz systemd-init-f63748cd80a7250d0f6b03e00fdf1af9c7b321b3.zip |
[slx-network] no domain for forced hostname
-rwxr-xr-x | builder/modules.d/slx-network/scripts/udhcpc-trigger.stage3 | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage3 b/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage3 index ee870873..d54939a8 100755 --- a/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage3 +++ b/builder/modules.d/slx-network/scripts/udhcpc-trigger.stage3 @@ -105,19 +105,19 @@ if [ -n "$ntpsrv" ]; then fi # Hostname -# Ignore it if hostname was forced per KCL +# Ignore hostname/fqdn it if hostname was forced per KCL. if [ -n "$SLX_PXE_HOSTNAME" ]; then echo "Hostname set via KCL, ignoring DHCP hostname: '$hostname'" hostname="$SLX_PXE_HOSTNAME" -fi - -if [ -z "$hostname" ]; then - # as with domain, if there's no hostname, try to get via DNS - echo "..trying to get hostname via DNS, as DHCP didn't supply one.." - [ -z "$fqdn" ] && fqdn=$(timeout -t 3 nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') - hostname="${fqdn%%.*}" -elif [ -n "$domain" ]; then - fqdn="${hostname}.${domain%% *}" # in case domain is a list +else + if [ -z "$hostname" ]; then + # as with domain, if there's no hostname, try to get via DNS + echo "..trying to get hostname via DNS, as DHCP didn't supply one.." + [ -z "$fqdn" ] && fqdn=$(timeout -t 3 nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') + hostname="${fqdn%%.*}" + elif [ -n "$domain" ]; then + fqdn="${hostname}.${domain%% *}" # in case domain is a list + fi fi if [ -z "$hostname" ]; then |