Release openresolv-3.3.4
[openresolv] / named.in
index 17e30ab70a8c6598092ffc52b8b481e7be720440..9d88910a7eed59080a999268cb03608983a07e71 100644 (file)
--- a/named.in
+++ b/named.in
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 2007-2009 Roy Marples <roy@marples.name>
+# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
 # All rights reserved
 
 # named subscriber for resolvconf
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "$named_zones" -o -z "$named_options" ] && exit 0
-: ${RESOLVCONF:=resolvconf}
-eval "$("$RESOLVCONF" -v)"
+[ -z "$named_zones" -a -z "$named_options" ] && exit 0
+[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
 
+: ${named_restart:=@RESTARTCMD named@}
 newoptions="# Generated by resolvconf\n"
 newzones="$newoptions"
+
 forward=
 for n in $NAMESERVERS; do
        case "$forward" in
@@ -61,18 +62,23 @@ done
 # No point in changing files or reloading bind if the end result has not
 # changed
 changed=false
-if [ ! -f "$named_options" ] || \
-       [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
-then
-       printf "$newoptions" > "$named_options"
-       changed=true
+if [ -n "$named_options" ]; then
+       if [ ! -f "$named_options" ] || \
+               [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
+       then
+               printf "$newoptions" >"$named_options"
+               changed=true
+       fi
 fi
-if [ ! -f "$named_zones" ] || \
-       [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
-then
-       printf "$newzones" >"$named_zones"
-       changed=true
+if [ -n "$named_zones" ]; then
+       if [ ! -f "$named_zones" ] || \
+               [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
+       then
+               printf "$newzones" >"$named_zones"
+               changed=true
+       fi
 fi
 
-$changed && $RESOLVCONF -s named restart
-exit 0
+if $changed; then
+       eval $named_restart
+fi