]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Build new_domain_name from other sources if blank before checking it's blank
authorRoy Marples <roy@marples.name>
Fri, 14 Aug 2015 12:35:19 +0000 (12:35 +0000)
committerRoy Marples <roy@marples.name>
Fri, 14 Aug 2015 12:35:19 +0000 (12:35 +0000)
to remove any prior config.
Fixes [a3aebc3b79]
Thanks to Paul Walrath.

dhcpcd-hooks/20-resolv.conf

index d99cc7fab3105d128028d9b2062f5758fdb84e44..35c406448108c4d8589d593cd144d0a211cc35ca 100644 (file)
@@ -117,14 +117,6 @@ add_resolv_conf()
        new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"
        new_domain_search="$new_domain_search${new_domain_search:+ }$new_dnssl"
 
-       # If we don't have any configuration, remove it
-       if [ -z "$new_domain_name_servers" -a \
-               -z "$new_domain_name" -a \
-               -z "$new_domain_search" ]; then
-               remove_resolv_conf
-               return $?
-       fi
-
        # Derive a new domain from our various hostname options
        if [ -z "$new_domain_name" ]; then
                if [ "$new_dhcp6_fqdn" != "${new_dhcp6_fqdn#*.}" ]; then
@@ -136,6 +128,14 @@ add_resolv_conf()
                fi
        fi
 
+       # If we don't have any configuration, remove it
+       if [ -z "$new_domain_name_servers" -a \
+               -z "$new_domain_name" -a \
+               -z "$new_domain_search" ]; then
+               remove_resolv_conf
+               return $?
+       fi
+
        if [ -n "$new_domain_name" ]; then
                set -- $new_domain_name
                if valid_domainname "$1"; then