resolvconf -v now outputs DOMAIN= which is the first domain (not search) processed.
[openresolv] / resolvconf.in
index a7a7d3b3b50b36e2021f4c816e256d1b9bc242d3..00bbce22ef08842b7d88ebefecb05ca76758f13b 100644 (file)
@@ -108,8 +108,9 @@ echo_resolv()
 parse_resolv()
 {
        local line= ns= ds= search= d= n= newns=
-       local new=true iface= private=false p=
+       local new=true iface= private=false p= domain=
 
+       echo "DOMAIN="
        echo "DOMAINS="
        echo "SEARCH=\"$search_domains\""
        # let our subscribers know about global nameservers
@@ -153,7 +154,14 @@ parse_resolv()
                        esac
                        ns="$ns${line#* } "
                        ;;
-               "domain "*|"search "*)
+               "domain "*)
+                       if [ -z "$domain" ]; then
+                               domain="${line#* }"
+                               echo "DOMAIN=\"$domain\""
+                       fi
+                       search="${line#* }"
+                       ;;
+               "search "*)
                        search="${line#* }"
                        ;;
                *)
@@ -309,10 +317,11 @@ make_vars()
                done
                newdomains="$newdomains$newns"
        done
-       echo "DOMAINS='$newdomains'"
+       echo "DOMAIN='$DOMAIN'"
        echo "SEARCH='$(uniqify $SEARCH)'"
        echo "NAMESERVERS='$(uniqify $NAMESERVERS)'"
        echo "LOCALNAMESERVERS='$(uniqify $LOCALNAMESERVERS)'"
+       echo "DOMAINS='$newdomains'"
 }
 
 force=false