Release openresolv-3.4.1
[openresolv] / pdnsd.in
index 72a20d3dac735c49ab5d1b3399162c11df65eb31..ff3b9b23ab5a975c579b2a51474c10f6782c73a6 100644 (file)
--- a/pdnsd.in
+++ b/pdnsd.in
@@ -28,7 +28,7 @@
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "$pdnsd_resolv" ] && exit 0
+[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
 
 : ${pdnsd_restart:=pdnsd-ctl config $pdnsd_conf}
@@ -83,16 +83,38 @@ change_file()
 newresolv="# Generated by resolvconf\n"
 changed=false
 
-for n in $NAMESERVERS; do
-       newresolv="${newresolv}nameserver $n\n"
-done
+if [ -n "$pdnsd_resolv" ]; then
+       for n in $NAMESERVERS; do
+               newresolv="${newresolv}nameserver $n\n"
+       done
+fi
 
 if [ -n "$pdnsd_conf" ]; then
        cf="$pdnsd_conf.new"
        newconf=
+
+       if [ -z "$pdnsd_resolv" ]; then
+               newconf="${newconf}server {\n"
+               newconf="${newconf}\tlabel=resolvconf;\n"
+               if [ -n "$NAMESERVERS" ]; then
+                       newconf="${newconf}\tip="
+                       first=true
+                       for n in $NAMESERVERS; do
+                               if $first; then
+                                       first=false
+                               else
+                                       newconf="${newconf},"
+                               fi
+                               newconf="$newconf$n"
+                       done
+                       newconf="${newconf};\n"
+               fi
+               newconf="${newconf}}\n"
+       fi
+
        for d in $DOMAINS; do
                newconf="${newconf}server {\n"
-               newconf="${newconf}\tinclude=\"${d%%:*}\";\n"
+               newconf="${newconf}\tinclude=.${d%%:*}.;\n"
                newconf="${newconf}\tpolicy=excluded;\n"
                newconf="${newconf}\tip="
                ns="${d#*:}"