Add (c) to Copyright
[openresolv] / pdns_recursor.in
old mode 100755 (executable)
new mode 100644 (file)
index 5e5f7f4..7e7c663
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 2009 Roy Marples
+# Copyright (c) 2009 Roy Marples
 # All rights reserved
 
 # PowerDNS Recursor subscriber for resolvconf
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$pdns_zones" ] && exit 0
-: ${RESOLVCONF:=resolvconf}
-eval "$("$RESOLVCONF" -v)"
+[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+
+: ${pdns_restart:=@RESTARTCMD pdns_recursor@}
 
 newzones=
-for n in $NAMESERVERS; do
-       newzones="$newzones${newzones:+,}$n"
-done
-[ -n "$newzones" ] && newzones=".=$newzones\n"
 
-dbusdest=
+# pds_recursor does not present support global forward servers, which
+# does limit it's usefulness somewhat.
+# If it did, the below code can be enabled, or something like it.
+#for n in $NAMESERVERS; do
+#      newzones="$newzones${newzones:+,}$n"
+#done
+#[ -n "$newzones" ] && newzones=".=$newzones\n"
+
 for d in $DOMAINS; do
        newns=
        ns="${d#*:}"
@@ -50,12 +54,9 @@ for d in $DOMAINS; do
        [ -n "$newns" ] && newzones="$newzones${d%%:*}=$newns\n"
 done
 
-changed=false
 if [ ! -f "$pdns_zones" ] || \
        [ "$(cat "$pdns_zones")" != "$(printf "$newzones")" ]
 then
-       changed=true
        printf "$newzones" >"$pdns_zones"
+       eval $pdns_restart
 fi
-
-$changed && $RESOLVCONF -s pdns_recursor restart
\ No newline at end of file