Module Name: src Committed By: kre Date: Mon Sep 24 21:58:11 UTC 2018
Modified Files: src/external/bsd/openresolv/dist: dnsmasq.in libc.in named.in pdnsd.in resolvconf.in Log Message: Resolvconf is (can be) used as part of network config during system installation, so also must confine itself to POSIX specified test ('[') usage. Pointed out by roy@ - thanks. To generate a diff of this commit: cvs rdiff -u -r1.1.1.11 -r1.2 src/external/bsd/openresolv/dist/dnsmasq.in \ src/external/bsd/openresolv/dist/libc.in cvs rdiff -u -r1.1.1.7 -r1.2 src/external/bsd/openresolv/dist/named.in cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/openresolv/dist/pdnsd.in cvs rdiff -u -r1.1.1.14 -r1.2 src/external/bsd/openresolv/dist/resolvconf.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/openresolv/dist/dnsmasq.in diff -u src/external/bsd/openresolv/dist/dnsmasq.in:1.1.1.11 src/external/bsd/openresolv/dist/dnsmasq.in:1.2 --- src/external/bsd/openresolv/dist/dnsmasq.in:1.1.1.11 Mon Apr 11 10:40:22 2016 +++ src/external/bsd/openresolv/dist/dnsmasq.in Mon Sep 24 21:58:11 2018 @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0 +[ -z "${dnsmasq_conf}${dnsmasq_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " @@ -98,7 +98,7 @@ for d in $DOMAINS; do empty=false i=0 IFS=: set -- $n - while [ -n "$1" -o -n "$2" ]; do + while [ -n "$1" ] || [ -n "$2" ]; do addr="$1" shift if [ -z "$addr" ]; then Index: src/external/bsd/openresolv/dist/libc.in diff -u src/external/bsd/openresolv/dist/libc.in:1.1.1.11 src/external/bsd/openresolv/dist/libc.in:1.2 --- src/external/bsd/openresolv/dist/libc.in:1.1.1.11 Fri Dec 30 19:42:05 2016 +++ src/external/bsd/openresolv/dist/libc.in Mon Sep 24 21:58:11 2018 @@ -98,10 +98,12 @@ fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} : ${list_resolv:=@SBINDIR@/resolvconf -l} -if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then +if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ] +then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" fi -if [ "${resolv_conf_tail-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.tail ]; then +if [ "${resolv_conf_tail-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.tail ] +then resolv_conf_tail="$(cat "$SYSCONFDIR"/resolv.conf.tail)" fi @@ -126,7 +128,7 @@ case "${resolv_conf_passthrough:-NO}" in backup=false newest= for conf in "$IFACEDIR"/*; do - if [ -z "$newest" -o "$conf" -nt "$newest" ]; then + if [ -z "$newest" ] || [ "$conf" -nt "$newest" ]; then newest="$conf" fi done @@ -178,7 +180,7 @@ case "${resolv_conf_passthrough:-NO}" in fi [ -n "$domain" ] && newconf="${newconf}domain $domain$NL" - if [ -n "$newsearch" -a "$newsearch" != "$domain" ]; then + if [ -n "$newsearch" ] && [ "$newsearch" != "$domain" ]; then newconf="${newconf}search $newsearch$NL" fi for n in $newns; do Index: src/external/bsd/openresolv/dist/named.in diff -u src/external/bsd/openresolv/dist/named.in:1.1.1.7 src/external/bsd/openresolv/dist/named.in:1.2 --- src/external/bsd/openresolv/dist/named.in:1.1.1.7 Mon Apr 11 10:40:22 2016 +++ src/external/bsd/openresolv/dist/named.in Mon Sep 24 21:58:11 2018 @@ -28,14 +28,14 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$named_zones" -a -z "$named_options" ] && exit 0 +[ -z "${named_zones}${named_options}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " # Platform specific kludges -if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "$RCDIR" -a ! -x "$RCDIR"/named ] +if [ -z "${named_service}${named_restart}" ] && + [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ] then if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives Index: src/external/bsd/openresolv/dist/pdnsd.in diff -u src/external/bsd/openresolv/dist/pdnsd.in:1.1.1.4 src/external/bsd/openresolv/dist/pdnsd.in:1.2 --- src/external/bsd/openresolv/dist/pdnsd.in:1.1.1.4 Fri Jul 12 16:50:27 2013 +++ src/external/bsd/openresolv/dist/pdnsd.in Mon Sep 24 21:58:11 2018 @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 +[ -z "${pdnsd_conf}${pdnsd_resolv}" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" NL=" " Index: src/external/bsd/openresolv/dist/resolvconf.in diff -u src/external/bsd/openresolv/dist/resolvconf.in:1.1.1.14 src/external/bsd/openresolv/dist/resolvconf.in:1.2 --- src/external/bsd/openresolv/dist/resolvconf.in:1.1.1.14 Fri Dec 30 19:42:05 2016 +++ src/external/bsd/openresolv/dist/resolvconf.in Mon Sep 24 21:58:11 2018 @@ -211,7 +211,7 @@ parse_resolv() ;; *) [ -n "$line" ] && continue - if [ -n "$ns" -a -n "$search" ]; then + if [ -n "$ns" ] && [ -n "$search" ]; then newns= for n in $ns; do newns="$newns${newns:+,}$n" @@ -297,64 +297,83 @@ detect_init() # systems we try to detect them first. local status="@STATUSARG@" : ${status:=status} - if [ -x /bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then - /bin/systemctl restart \$1.service; -fi" - elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then - RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then - /usr/bin/systemctl restart \$1.service; -fi" - elif [ -x /sbin/rc-service -a \ - -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /bin/systemctl --quiet is-active $1.service + then + /bin/systemctl restart $1.service + fi' + elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then + RESTARTCMD=' + if /usr/bin/systemctl --quiet is-active $1.service + then + /usr/bin/systemctl restart $1.service + fi' + elif [ -x /sbin/rc-service ] && [ -s /libexec/rc/init.d/softlevel ] || + [ -s /run/openrc/softlevel ] then - RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart' elif [ -x /usr/sbin/invoke-rc.d ]; then RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then - /usr/sbin/invoke-rc.d \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1 + then + /usr/sbin/invoke-rc.d $1 restart + fi' elif [ -x /sbin/service ]; then # Old RedHat RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \$1; then - /sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /sbin/service $1; then + /sbin/service $1 restart + fi' elif [ -x /usr/sbin/service ]; then # Could be FreeBSD - RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then - /usr/sbin/service \$1 restart; -fi" + RESTARTCMD=' + if /usr/sbin/service $1 $status >/dev/null 2>&1 + then + /usr/sbin/service $1 restart + fi' elif [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv status \$1 >/dev/null 2>&1 && /bin/sv try-restart \$1" + RESTARTCMD='/bin/sv status $1 >/dev/null 2>&1 && + /bin/sv try-restart $1' elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv status \$1 >/dev/null 2>&1 && /usr/bin/sv try-restart \$1" - elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then + RESTARTCMD='/usr/bin/sv status $1 >/dev/null 2>&1 && + /usr/bin/sv try-restart $1' + elif [ -e /etc/arch-release ] && [ -d /etc/rc.d ]; then RCDIR=/etc/rc.d - RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then - /etc/rc.d/\$1 restart; -fi" - elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then - RESTARTCMD="if /etc/rc.d/rc.\$1 status 1>/dev/null 2>&1; then - /etc/rc.d/rc.\$1 restart; -fi" - elif [ -e /etc/rc.d/rc.subr -a -d /etc/rc.d ]; then + RESTARTCMD=' + if [ -e /var/run/daemons/$1 ] + then + /etc/rc.d/$1 restart + fi' + elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then + RESTARTCMD=' + if /etc/rc.d/rc.$1 status >/dev/null 2>&1 + then + /etc/rc.d/rc.$1 restart + fi' + elif [ -e /etc/rc.d/rc.subr ] && [ -d /etc/rc.d ]; then # OpenBSD - RESTARTCMD="if /etc/rc.d/\$1 check 1>/dev/null 2>&1; then - /etc/rc.d/\$1 restart; -fi" + RESTARTCMD=' + if /etc/rc.d/$1 check >/dev/null 2>&1 + then + /etc/rc.d/$1 restart + fi' else for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do [ -d $x ] || continue - RESTARTCMD="if $x/\$1 $status 1>/dev/null 2>&1; then - $x/\$1 restart; -fi" + RESTARTCMD=" + if $x/\$1 $status >/dev/null 2>&1 + then + $x/\$1 restart + fi" break done fi if [ -z "$RESTARTCMD" ]; then - if [ "$NOINIT_WARNED" != true ]; then + if [ "$_NOINIT_WARNED" != true ]; then warn "could not detect a useable init system" _NOINIT_WARNED=true fi @@ -368,7 +387,7 @@ echo_resolv() { local line= OIFS="$IFS" - [ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1 + [ -n "$1" ] && [ -f "$IFACEDIR/$1" ] || return 1 echo "# resolv.conf from $1" # Our variable maker works of the fact each resolv.conf per interface # is separated by blank lines. @@ -405,7 +424,7 @@ list_resolv() excl=true cd "$IFACEDIR" for i in $inclusive_interfaces; do - if [ -f "$i" -a "$list" = "$i" ]; then + if [ -f "$i" ] && [ "$list" = "$i" ]; then list= excl=false break @@ -431,11 +450,12 @@ list_resolv() done done for i in $dynamic_order; do - if [ -e "$i" -a ! -e "$METRICDIR/"*" $i" ]; then + if [ -e "$i" ] && ! [ -e "$METRICDIR/"*" $i" ]; then list="$list $i" fi for ii in "$i":* "$i".*; do - if [ -f "$ii" -a ! -e "$METRICDIR/"*" $ii" ]; then + if [ -f "$ii" ] && ! [ -e "$METRICDIR/"*" $ii" ] + then list="$list $ii" fi done @@ -461,14 +481,14 @@ list_resolv() continue fi - if [ "$cmd" = i -o "$cmd" = "-i" ]; then + if [ "$cmd" = i ] || [ "$cmd" = "-i" ]; then printf %s "$i " else echo_resolv "$i" && echo fi - [ $? = 0 -a "$retval" = 1 ] && retval=0 + [ $? = 0 ] && [ "$retval" = 1 ] && retval=0 done - [ "$cmd" = i -o "$cmd" = "-i" ] && echo + [ "$cmd" = i ] || [ "$cmd" = "-i" ] && echo return $retval } @@ -575,7 +595,7 @@ make_vars() NAMESERVERS= LOCALNAMESERVERS= - if [ -n "$name_servers" -o -n "$search_domains" ]; then + if [ -n "${name_servers}${search_domains}" ]; then eval "$(echo_prepend | parse_resolv)" fi if [ -z "$VFLAG" ]; then @@ -583,7 +603,7 @@ make_vars() list_resolv -i "$@" >/dev/null || IF_EXCLUSIVE=0 eval "$(list_resolv -l "$@" | replace | parse_resolv)" fi - if [ -n "$name_servers_append" -o -n "$search_domains_append" ]; then + if [ -n "${name_servers_append}${search_domains_append} ]; then eval "$(echo_append | parse_resolv)" fi @@ -667,13 +687,13 @@ if [ "$cmd" = D ]; then fi # -l lists our resolv files, optionally for a specific interface -if [ "$cmd" = l -o "$cmd" = i ]; then +if [ "$cmd" = l ] || [ "$cmd" = i ]; then list_resolv "$cmd" "$args" exit $? fi # Restart a service or echo the command to restart a service -if [ "$cmd" = r -o "$cmd" = R ]; then +if [ "$cmd" = r ] || [ "$cmd" = R ]; then detect_init || exit 1 if [ "$cmd" = r ]; then set -- $args @@ -685,18 +705,18 @@ if [ "$cmd" = r -o "$cmd" = R ]; then fi # Not normally needed, but subscribers should be able to run independently -if [ "$cmd" = v -o -n "$VFLAG" ]; then +if [ "$cmd" = v ] || [ -n "$VFLAG" ]; then make_vars "$iface" exit $? fi # Test that we have valid options -if [ "$cmd" = a -o "$cmd" = d ]; then +if [ "$cmd" = a ] || [ "$cmd" = d ]; then if [ -z "$iface" ]; then usage "Interface not specified" fi elif [ "$cmd" != u ]; then - [ -n "$cmd" -a "$cmd" != h ] && usage "Unknown option $cmd" + [ -n "$cmd" ] && [ "$cmd" != h ] && usage "Unknown option $cmd" usage fi @@ -712,7 +732,7 @@ if [ "$cmd" = a ]; then "$x not allowed at start of interface name";; esac done - [ "$cmd" = a -a -t 0 ] && error_exit "No file given via stdin" + [ "$cmd" = a ] && [ -t 0 ] && error_exit "No file given via stdin" fi if [ ! -d "$VARDIR" ]; then @@ -808,8 +828,8 @@ a) newmetric="$METRICDIR/$IF_METRIC $iface" fi rm -f "$METRICDIR/"*" $iface" - [ "$oldmetric" != "$newmetric" -a \ - "$oldmetric" != "$METRICDIR/* $iface" ] && + [ "$oldmetric" != "$newmetric" ] && + [ "$oldmetric" != "$METRICDIR/* $iface" ] && changed=true [ -n "$newmetric" ] && echo " " >"$newmetric"