diff options
Diffstat (limited to 'modules.d/slx-network')
-rw-r--r-- | modules.d/slx-network/hooks/copy-network-files.sh | 6 | ||||
-rwxr-xr-x | modules.d/slx-network/scripts/udhcpc-trigger.stage3 | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/modules.d/slx-network/hooks/copy-network-files.sh b/modules.d/slx-network/hooks/copy-network-files.sh index d1dd48d1..5d28669e 100644 --- a/modules.d/slx-network/hooks/copy-network-files.sh +++ b/modules.d/slx-network/hooks/copy-network-files.sh @@ -6,13 +6,13 @@ if [ -n "$NEWROOT" ]; then # backup network configuration files found in stage4 for file in /etc/{hostname,hosts,resolv.conf}; do if [ ! -e "$file" ]; then - warn "Missing '$file' - won't move it to stage4. " + warn "Missing '$file' - can't move it to stage4. " continue fi if [ -e "${NEWROOT}/${file}" ] || [ -h "${NEWROOT}/${file}" ]; then - mv "${NEWROOT}/${file}" "${NEWROOT}/${file}.stage4" + mv "${NEWROOT}/${file}" "${NEWROOT}/${file}.renamed-by-stage3" fi - cp -af "$file" "${NEWROOT}/etc" + cp -af "$file" "${NEWROOT}/etc/" done # special handling for resolv.conf: # move it to /opt/openslx to detect we are managing it diff --git a/modules.d/slx-network/scripts/udhcpc-trigger.stage3 b/modules.d/slx-network/scripts/udhcpc-trigger.stage3 index 5833c0b4..82a21f6f 100755 --- a/modules.d/slx-network/scripts/udhcpc-trigger.stage3 +++ b/modules.d/slx-network/scripts/udhcpc-trigger.stage3 @@ -84,6 +84,12 @@ done # always check DNS echo "Checking DNS record for this host..." [ -z "$fqdn" ] && fqdn="$(reverse_lookup "$ip")" +[ -z "$fqdn" ] && [ -n "$hostname" ] && [ -n "$domain" ] && fqdn="${hostname}.${domain}" +# Otherwise, retry DNS one time +if [ -z "$fqdn" ]; then + sleep 1 + fqdn="$(reverse_lookup "$ip")" +fi [ -n "$fqdn" ] && fqdn_hostname="${fqdn%%.*}" if [ -z "$domain" ]; then @@ -105,16 +111,16 @@ fi # Write out if [ -n "$domain" ]; then echo "domain $domain" >> "/etc/resolv.conf" - echo "SLX_NET_DOMAIN='$domain'" >> "/run/openslx/network.conf" + echo "SLX_NET_DOMAIN='$domain'" >> "$NETWORK_CONF" fi if [ -n "$search" ]; then echo "search $search" >> "/etc/resolv.conf" - echo "SLX_NET_SEARCH='$search'" >> "/run/openslx/network.conf" + echo "SLX_NET_SEARCH='$search'" >> "$NETWORK_CONF" fi if [ -n "$ntpsrv" ]; then - echo "SLX_DHCP_NTP='$ntpsrv'" >> "/run/openslx/network.conf" + echo "SLX_DHCP_NTP='$ntpsrv'" >> "$NETWORK_CONF" fi # Hostname |