diff options
author | hrs <hrs@FreeBSD.org> | 2011-09-13 02:46:22 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2011-09-13 02:46:22 +0000 |
commit | ce750aacfc656eeafcd42ef8b5dfc3f93d07caaf (patch) | |
tree | 61b97fc7e5fb16befee5a21d465e85162e5af28f /contrib/openresolv/unbound.in | |
parent | 6a7d91769a91f7e4cbe398cc41202ef07e2a0e8a (diff) | |
download | FreeBSD-src-ce750aacfc656eeafcd42ef8b5dfc3f93d07caaf.zip FreeBSD-src-ce750aacfc656eeafcd42ef8b5dfc3f93d07caaf.tar.gz |
Merge from openresolv 3.4.4 in the vendor branch.
Approved by: re (kib)
Diffstat (limited to 'contrib/openresolv/unbound.in')
-rw-r--r-- | contrib/openresolv/unbound.in | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/openresolv/unbound.in b/contrib/openresolv/unbound.in index b5fb7ec..aa04a31 100644 --- a/contrib/openresolv/unbound.in +++ b/contrib/openresolv/unbound.in @@ -30,34 +30,36 @@ . "@SYSCONFDIR@/resolvconf.conf" || exit 1 [ -z "$unbound_conf" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)" +NL=" +" : ${unbound_pid:=/var/run/unbound.pid} : ${unbound_service:=unbound} : ${unbound_restart:=@RESTARTCMD ${unbound_service}@} -newconf="# Generated by resolvconf\n" +newconf="# Generated by resolvconf$NL" for d in $DOMAINS; do dn="${d%%:*}" ns="${d#*:}" - newconf="${newconf}\nforward-zone:\n\tname: \"$dn\"\n" + newconf="$newconf${NL}forward-zone:$NL name: \"$dn\"$NL" while [ -n "$ns" ]; do - newconf="${newconf}\tforward-addr: ${ns%%,*}\n" + newconf="$newconf forward-addr: ${ns%%,*}$NL" [ "$ns" = "${ns#*,}" ] && break ns="${ns#*,}" done done if [ -n "$NAMESERVERS" ]; then - newconf="${newconf}\nforward-zone:\n\tname: \".\"\n" + newconf="$newconf${NL}forward-zone:$NL name: \".\"$NL" for n in $NAMESERVERS; do - newconf="${newconf}\tforward-addr: $n\n" + newconf="$newconf forward-addr: $n$NL" done fi if [ ! -f "$unbound_conf" ] || \ - [ "$(cat "$unbound_conf")" != "$(printf "$newconf")" ] + [ "$(cat "$unbound_conf")" != "$(printf %s "$newconf")" ] then - printf "$newconf" >"$unbound_conf" + printf %s "$newconf" >"$unbound_conf" # If we can't sent a HUP then force a restart if [ -s "$unbound_pid" ]; then if ! kill -HUP $(cat "$unbound_pid") 2>/dev/null; then |