diff options
-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%%.*}" |