Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/openresolv/dist Import openresolv-3.9.0 with th...



details:   https://anonhg.NetBSD.org/src/rev/a88150a23775
branches:  trunk
changeset: 349982:a88150a23775
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Dec 30 19:42:05 2016 +0000

description:
Import openresolv-3.9.0 with the following changes:
  *  Added --version option
  *  Fix pdns_recursor restart command
  *  Append a newline when restoring resolv.conf
  *  public_interfaces overrides private interface markings
  *  Fix runit support
  *  inclusive_interfaces overrides exclusive interface markings

diffstat:

 external/bsd/openresolv/dist/libc.in       |   2 +-
 external/bsd/openresolv/dist/resolvconf.in |  70 ++++++++++++++++++++++-------
 2 files changed, 53 insertions(+), 19 deletions(-)

diffs (170 lines):

diff -r bbc71b842a74 -r a88150a23775 external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in      Fri Dec 30 18:30:19 2016 +0000
+++ b/external/bsd/openresolv/dist/libc.in      Fri Dec 30 19:42:05 2016 +0000
@@ -216,7 +216,7 @@
 if $backup; then
        if [ "$newconf" = "$signature$NL" ]; then
                if [ -e "$resolv_conf.bak" ]; then
-                       newconf="$(cat "$resolv_conf.bak")"
+                       newconf="$(cat "$resolv_conf.bak")$NL"
                fi
        elif [ -e "$resolv_conf" ]; then
                read line <"$resolv_conf"
diff -r bbc71b842a74 -r a88150a23775 external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in        Fri Dec 30 18:30:19 2016 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.in        Fri Dec 30 19:42:05 2016 +0000
@@ -25,13 +25,19 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.8.0"
+OPENRESOLV_VERSION="3.9.0"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
 RCDIR=@RCDIR@
 RESTARTCMD=@RESTARTCMD@
 
+if [ "$1" = "--version" ]; then
+       echo "openresolv $OPENRESOLV_VERSION"
+       echo "Copyright (c) 2007-2016 Roy Marples"
+       exit 0
+fi
+
 # Disregard dhcpcd setting
 unset interface_order state_dir
 
@@ -90,9 +96,10 @@
                           that match the specified pattern
 
          -u               Run updates from our current DNS information
+         --version        Echo the ${RESOLVCONF##*/} version
 
        Options:
-         -f               Ignore non existant interfaces
+         -f               Ignore non existent interfaces
          -m metric        Give the added DNS information a metric
          -p               Mark the interface as private
          -x               Mark the interface as exclusive
@@ -129,6 +136,34 @@
        printf "\n"
 }
 
+private_iface()
+{
+       local p
+
+       # Allow expansion
+       cd "$IFACEDIR"
+
+       # Public interfaces override private ones.
+       for p in $public_interfaces; do
+               case "$iface" in
+               "$p"|"$p":*) return 1;;
+               esac
+       done
+
+       if [ -e "$PRIVATEDIR/$iface" ]; then
+               return 0
+       fi
+       
+       for p in $private_interfaces; do
+               case "$iface" in
+               "$p"|"$p":*) return 0;;
+               esac
+       done
+
+       # Not a private interface
+       return 1
+}
+
 # Parse resolv.conf's and make variables
 # for domain name servers, search name servers and global nameservers
 parse_resolv()
@@ -144,17 +179,10 @@
                        if ${new}; then
                                iface="${line#\# resolv.conf from *}"
                                new=false
-                               if [ -e "$PRIVATEDIR/$iface" ]; then
+                               if private_iface "$iface"; then
                                        private=true
                                else
-                                       # Allow expansion
-                                       cd "$IFACEDIR"
                                        private=false
-                                       for p in $private_interfaces; do
-                                               case "$iface" in
-                                               "$p"|"$p":*) private=true; break;;
-                                               esac
-                                       done
                                fi
                        fi
                        ;;
@@ -270,11 +298,11 @@
        local status="@STATUSARG@"
        : ${status:=status}
        if [ -x /bin/systemctl -a -S /run/systemd/private ]; then
-               RESTARTCMD="if /bin/systemctl --quiet is-active; 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; 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 \
@@ -298,9 +326,9 @@
        /usr/sbin/service \$1 restart;
 fi"
        elif [ -x /bin/sv ]; then
-               RESTARTCMD="/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 try-restart \$1"
+               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
                RCDIR=/etc/rc.d
                RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then
@@ -375,6 +403,14 @@
                        done
                fi
                excl=true
+               cd "$IFACEDIR"
+               for i in $inclusive_interfaces; do
+                       if [ -f "$i" -a "$list" = "$i" ]; then
+                               list=
+                               excl=false
+                               break
+                       fi
+               done
                ;;
        *)
                excl=false
@@ -415,7 +451,6 @@
 
        cd "$IFACEDIR"
        retval=1
-       excl=true
        for i in $(uniqify $list); do
                # Only list interfaces which we really have
                if ! [ -f "$i" ]; then
@@ -429,8 +464,7 @@
                if [ "$cmd" = i -o "$cmd" = "-i" ]; then
                        printf %s "$i "
                else
-                       echo_resolv "$i"
-                       echo
+                       echo_resolv "$i" && echo
                fi
                [ $? = 0 -a "$retval" = 1 ] && retval=0
        done
@@ -884,7 +918,7 @@
 retval=0
 
 # Run scripts in the same directory resolvconf is run from
-# in case any scripts accidently dump files in the wrong place.
+# in case any scripts accidentally dump files in the wrong place.
 cd "$_PWD"
 for script in "$LIBEXECDIR"/*; do
        if [ -f "$script" ]; then



Home | Main Index | Thread Index | Old Index