diff options
author | Simon Rettberg | 2023-06-21 17:34:18 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-06-21 17:34:18 +0200 |
commit | d0b5942eaf667c20a8d415710c510309163d3c08 (patch) | |
tree | 6c777f5c92eef38971b70cdb6dd2564454848ae5 /core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | |
parent | [run-virt] Little bugfix linux scripts sound mute function (diff) | |
download | mltk-d0b5942eaf667c20a8d415710c510309163d3c08.tar.gz mltk-d0b5942eaf667c20a8d415710c510309163d3c08.tar.xz mltk-d0b5942eaf667c20a8d415710c510309163d3c08.zip |
[dhcpc-busybox] hostname fallback: Try harder
Diffstat (limited to 'core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx')
-rwxr-xr-x | core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index 327bdaa4..99e8b0dd 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -201,18 +201,26 @@ case "$1" in sed -i "/^SLX_NET_WINS=/d" /opt/openslx/config echo "SLX_NET_WINS='$wins'" >> /opt/openslx/config fi - + + if [ -z "$dns_fqdn" ] && [ -n "$domain" ] && [ -n "$hostname" ]; then + # fallback to what the dhcp told us + dns_fqdn="${hostname}.${domain}" + fi + if [ -z "$dns_fqdn" ]; then + dns_fqdn="$( hostname -f )" + fi + if [ -z "$dns_fqdn" ]; then + if [ -s "/etc/hostname" ]; then + dns_fqdn="$( head -n 1 /etc/hostname )" + else + dns_fqdn="noname-${ip//./-}.invalid" + fi + fi + # Only update hostname if network is not ready yet # later on this might cause issues if ! [ -e "$flag" ]; then # Update hostname - if [ -z "$dns_fqdn" ] && [ -n "$domain" ] && [ -n "$hostname" ]; then - # fallback to what the dhcp told us - dns_fqdn="${hostname}.${domain}" - fi - if [ -z "$dns_fqdn" ] && ! [ -s "/etc/hostname" ]; then - dns_fqdn="noname-${ip//./-}" - fi # finally, if dns_fqdn was set to anything, apply it if [ -n "$dns_fqdn" ]; then dns_short="${dns_fqdn%%.*}" |