Date: Tue, 13 Sep 2011 02:46:23 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r225524 - head/contrib/openresolv Message-ID: <201109130246.p8D2kNgh056241@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Tue Sep 13 02:46:22 2011 New Revision: 225524 URL: http://svn.freebsd.org/changeset/base/225524 Log: Merge from openresolv 3.4.4 in the vendor branch. Approved by: re (kib) Modified: head/contrib/openresolv/dnsmasq.in head/contrib/openresolv/libc.in head/contrib/openresolv/named.in head/contrib/openresolv/pdnsd.in head/contrib/openresolv/resolvconf.in head/contrib/openresolv/unbound.in Directory Properties: head/contrib/openresolv/ (props changed) Modified: head/contrib/openresolv/dnsmasq.in ============================================================================== --- head/contrib/openresolv/dnsmasq.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/dnsmasq.in Tue Sep 13 02:46:22 2011 (r225524) @@ -30,12 +30,14 @@ . "@SYSCONFDIR@/resolvconf.conf" || exit 1 [ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)" +NL=" +" : ${dnsmasq_pid:=/var/run/dnsmasq.pid} [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid : ${dnsmasq_service:=dnsmasq} : ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@} -newconf="# Generated by resolvconf\n" +newconf="# Generated by resolvconf$NL" newresolv="$newconf" # Using dbus means that we never have to restart the daemon @@ -56,14 +58,14 @@ if [ -s "$dbus_pid" -a -s "$dnsmasq_pid" kill -0 $(cat "$dnsmasq_pid") 2>/dev/null then dbus=true - newconf="$newconf\n# Domain specific servers will" - newconf="$newconf be sent over dbus\nenable-dbus\n" + newconf="$newconf$NL# Domain specific servers will" + newconf="$newconf be sent over dbus${NL}enable-dbus$NL" fi fi fi for n in $NAMESERVERS; do - newresolv="${newresolv}nameserver $n\n" + newresolv="${newresolv}nameserver $n$NL" done dbusdest= @@ -75,16 +77,16 @@ for d in $DOMAINS; do SIFS=${IFS-y} OIFS=$IFS IFS=. set -- ${ns%%,*} - num="0x$(printf "%02x" $1 $2 $3 $4)" + num="0x$(printf %02x $1 $2 $3 $4)" if [ "$SIFS" = yi ]; then unset IFS else IFS=$OIFS fi - dbusdest="$dbusdest uint32:$(printf "%u" $num)" + dbusdest="$dbusdest uint32:$(printf %u $num)" dbusdest="$dbusdest string:$dn" else - newconf="${newconf}server=/$dn/${ns%%,*}\n" + newconf="${newconf}server=/$dn/${ns%%,*}$NL" fi [ "$ns" = "${ns#*,}" ] && break ns="${ns#*,}" @@ -94,22 +96,22 @@ done changed=false if [ -n "$dnsmasq_conf" ]; then if [ ! -f "$dnsmasq_conf" ] || \ - [ "$(cat "$dnsmasq_conf")" != "$(printf "$newconf")" ] + [ "$(cat "$dnsmasq_conf")" != "$(printf %s "$newconf")" ] then changed=true - printf "$newconf" >"$dnsmasq_conf" + printf %s "$newconf" >"$dnsmasq_conf" fi fi if [ -n "$dnsmasq_resolv" ]; then if [ -f "$dnsmasq_resolv" ]; then - if [ "$(cat "$dnsmasq_resolv")" != "$(printf "$newresolv")" ] + if [ "$(cat "$dnsmasq_resolv")" != "$(printf %s "$newresolv")" ] then changed=true - printf "$newresolv" >"$dnsmasq_resolv" + printf %s "$newresolv" >"$dnsmasq_resolv" fi else # dnsmasq polls this file so no need to set changed=true - printf "$newresolv" >"$dnsmasq_resolv" + printf %s "$newresolv" >"$dnsmasq_resolv" fi fi Modified: head/contrib/openresolv/libc.in ============================================================================== --- head/contrib/openresolv/libc.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/libc.in Tue Sep 13 02:46:22 2011 (r225524) @@ -30,6 +30,8 @@ SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ IFACEDIR="$VARDIR/interfaces" +NL=" +" # sed may not be available, and this is faster on small files key_get_value() @@ -109,7 +111,7 @@ case "${resolv_conf_passthrough:-NO}" in fi done [ -z "$newest" ] && exit 0 - newconf="$(cat "$newest")\n" + newconf="$(cat "$newest")$NL" ;; *) [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)" @@ -118,13 +120,13 @@ case "${resolv_conf_passthrough:-NO}" in newns="$(uniqify $name_servers $NS $name_servers_append)" # Hold our new resolv.conf in a variable to save on temporary files - newconf="# Generated by resolvconf\n" + newconf="# Generated by resolvconf$NL" if [ -n "$resolv_conf_head" ]; then - newconf="$newconf$resolv_conf_head\n" + newconf="$newconf$resolv_conf_head$NL" fi - [ -n "$newsearch" ] && newconf="${newconf}search $newsearch\n" + [ -n "$newsearch" ] && newconf="${newconf}search $newsearch$NL" for n in $newns; do - newconf="${newconf}nameserver $n\n" + newconf="${newconf}nameserver $n$NL" done # Now get any configured options @@ -135,22 +137,22 @@ case "${resolv_conf_passthrough:-NO}" in for opt in $(uniqify $opts); do newconf="${newconf} $opt" done - newconf="$newconf\n" + newconf="$newconf$NL" fi if [ -n "$resolv_conf_tail" ]; then - newconf="$newconf$resolv_conf_tail\n" + newconf="$newconf$resolv_conf_tail$NL" fi ;; esac # Check if the file has actually changed or not if [ -e "$resolv_conf" ]; then - [ "$(cat "$resolv_conf")" = "$(printf "$newconf")" ] && exit 0 + [ "$(cat "$resolv_conf")" = "$(printf %s "$newconf")" ] && exit 0 fi # Create our resolv.conf now -(umask 022; printf "$newconf" >"$resolv_conf") +(umask 022; echo "$newconf" >"$resolv_conf") eval $libc_restart retval=0 Modified: head/contrib/openresolv/named.in ============================================================================== --- head/contrib/openresolv/named.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/named.in Tue Sep 13 02:46:22 2011 (r225524) @@ -30,6 +30,8 @@ . "@SYSCONFDIR@/resolvconf.conf" || exit 1 [ -z "$named_zones" -a -z "$named_options" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)" +NL=" +" # Platform specific kludges if [ -z "$named_service" -a -z "$named_restart" -a \ @@ -42,31 +44,31 @@ then fi : ${named_service:=named} : ${named_restart:=@RESTARTCMD ${named_service}@} -newoptions="# Generated by resolvconf\n" +newoptions="# Generated by resolvconf$NL" newzones="$newoptions" forward= for n in $NAMESERVERS; do case "$forward" in - *"\n\t$n;"*);; - *) forward="$forward\n\t$n;";; + *"$NL $n;"*);; + *) forward="$forward$NL $n;";; esac done if [ -n "$forward" ]; then - newoptions="${newoptions}forward first;\nforwarders {$forward\n};\n" + newoptions="${newoptions}forward first;${NL}forwarders {$forward${NL}};$NL" fi for d in $DOMAINS; do - newzones="${newzones}zone \"${d%%:*}\" {\n" - newzones="$newzones\ttype forward;\n" - newzones="$newzones\tforward first;\n\tforwarders {\n" + newzones="${newzones}zone \"${d%%:*}\" {$NL" + newzones="$newzones type forward;$NL" + newzones="$newzones forward first;$NL forwarders {$NL" ns="${d#*:}" while [ -n "$ns" ]; do - newzones="$newzones\t\t${ns%%,*};\n" + newzones="$newzones ${ns%%,*};$NL" [ "$ns" = "${ns#*,}" ] && break ns="${ns#*,}" done - newzones="$newzones\t};\n};\n" + newzones="$newzones };$NL};$NL" done # No point in changing files or reloading bind if the end result has not @@ -74,17 +76,17 @@ done changed=false if [ -n "$named_options" ]; then if [ ! -f "$named_options" ] || \ - [ "$(cat "$named_options")" != "$(printf "$newoptions")" ] + [ "$(cat "$named_options")" != "$(printf %s "$newoptions")" ] then - printf "$newoptions" >"$named_options" + printf %s "$newoptions" >"$named_options" changed=true fi fi if [ -n "$named_zones" ]; then if [ ! -f "$named_zones" ] || \ - [ "$(cat "$named_zones")" != "$(printf "$newzones")" ] + [ "$(cat "$named_zones")" != "$(printf %s "$newzones")" ] then - printf "$newzones" >"$named_zones" + printf %s "$newzones" >"$named_zones" changed=true fi fi Modified: head/contrib/openresolv/pdnsd.in ============================================================================== --- head/contrib/openresolv/pdnsd.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/pdnsd.in Tue Sep 13 02:46:22 2011 (r225524) @@ -131,7 +131,7 @@ if [ -n "$pdnsd_conf" ]; then remove_markers "$signature" "$signature_end" "$pdnsd_conf" > "$cf" if [ -n "$newconf" ]; then echo "$signature" >> "$cf" - printf "$newconf" >> "$cf" + printf %s "$newconf" >> "$cf" echo "$signature_end" >> "$cf" fi if change_file "$pdnsd_conf" "$cf"; then @@ -141,10 +141,10 @@ fi if [ -n "$pdnsd_resolv" ]; then if [ ! -f "$pdnsd_resolv" ] || \ - [ "$(cat "$pdnsd_resolv")" != "$(printf "$newresolv")" ] + [ "$(cat "$pdnsd_resolv")" != "$(printf %s "$newresolv")" ] then changed=true - printf "$newresolv" >"$pdnsd_resolv" + printf %s "$newresolv" >"$pdnsd_resolv" fi fi Modified: head/contrib/openresolv/resolvconf.in ============================================================================== --- head/contrib/openresolv/resolvconf.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/resolvconf.in Tue Sep 13 02:46:22 2011 (r225524) @@ -368,17 +368,17 @@ fi if [ "$cmd" = a ]; then # Read resolv.conf from stdin - resolv="$(cat)\n" + resolv="$(cat)" # If what we are given matches what we have, then do nothing if [ -e "$IFACEDIR/$iface" ]; then - if [ "$(printf "$resolv")" = \ + if [ "$(echo "$resolv")" = \ "$(cat "$IFACEDIR/$iface")" ] then exit 0 fi rm "$IFACEDIR/$iface" fi - printf "$resolv" >"$IFACEDIR/$iface" || exit $? + echo "$resolv" >"$IFACEDIR/$iface" || exit $? [ ! -d "$METRICDIR" ] && mkdir "$METRICDIR" rm -f "$METRICDIR/"*" $iface" if [ -n "$IF_METRIC" ]; then Modified: head/contrib/openresolv/unbound.in ============================================================================== --- head/contrib/openresolv/unbound.in Tue Sep 13 02:41:09 2011 (r225523) +++ head/contrib/openresolv/unbound.in Tue Sep 13 02:46:22 2011 (r225524) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109130246.p8D2kNgh056241>