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.8.0 with th...
details: https://anonhg.NetBSD.org/src/rev/158cb30f2e83
branches: trunk
changeset: 344686:158cb30f2e83
user: roy <roy%NetBSD.org@localhost>
date: Mon Apr 11 10:40:21 2016 +0000
description:
Import openresolv-3.8.0 with the following changes:
* init system detection moved from configure into resolvconf.
* Fixed multiple domains not bein separated correctly.
diffstat:
external/bsd/openresolv/dist/dnsmasq.in | 13 +-
external/bsd/openresolv/dist/libc.in | 12 +-
external/bsd/openresolv/dist/named.in | 24 ++-
external/bsd/openresolv/dist/resolvconf.in | 184 +++++++++++++++++++++++-----
external/bsd/openresolv/dist/unbound.in | 19 ++-
5 files changed, 201 insertions(+), 51 deletions(-)
diffs (truncated from 443 to 300 lines):
diff -r 52ddedb968ad -r 158cb30f2e83 external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in Mon Apr 11 09:21:18 2016 +0000
+++ b/external/bsd/openresolv/dist/dnsmasq.in Mon Apr 11 10:40:21 2016 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2007-2012 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
# All rights reserved
# dnsmasq subscriber for resolvconf
@@ -37,7 +37,6 @@
[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
: ${dnsmasq_service:=dnsmasq}
-: ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
newconf="# Generated by resolvconf$NL"
newresolv="$newconf"
@@ -180,7 +179,15 @@
fi
if $changed; then
- eval $dnsmasq_restart
+ # dnsmasq does not re-read the configuration file on SIGHUP
+ if [ -n "$dnsmasq_restart" ]; then
+ eval $dnsmasq_restart
+ elif [ -n "$RESTARTCMD" ]; then
+ set -- ${dnsmasq_service}
+ eval $RESTARTCMD
+ else
+ @SBINDIR@/resolvconf -r ${dnsmasq_service}
+ fi
fi
if $dbus; then
if [ -s "$dnsmasq_pid" ]; then
diff -r 52ddedb968ad -r 158cb30f2e83 external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in Mon Apr 11 09:21:18 2016 +0000
+++ b/external/bsd/openresolv/dist/libc.in Mon Apr 11 10:40:21 2016 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2007-2014 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
# All rights reserved
# libc subscriber for resolvconf
@@ -97,7 +97,6 @@
fi
: ${resolv_conf:=/etc/resolv.conf}
: ${libc_service:=nscd}
-: ${libc_restart:=@RESTARTCMD ${libc_service}@}
: ${list_resolv:=@SBINDIR@/resolvconf -l}
if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then
resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"
@@ -229,7 +228,14 @@
# Create our resolv.conf now
(umask 022; printf %s "$newconf" >"$resolv_conf")
-eval $libc_restart
+if [ -n "$libc_restart" ]; then
+ eval $libc_restart
+elif [ -n "$RESTARTCMD" ]; then
+ set -- ${libc_service}
+ eval $RESTARTCMD
+else
+ @SBINDIR@/resolvconf -r ${libc_service}
+fi
retval=0
# Notify users of the resolver
diff -r 52ddedb968ad -r 158cb30f2e83 external/bsd/openresolv/dist/named.in
--- a/external/bsd/openresolv/dist/named.in Mon Apr 11 09:21:18 2016 +0000
+++ b/external/bsd/openresolv/dist/named.in Mon Apr 11 10:40:21 2016 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2007-2012 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
# All rights reserved
# named subscriber for resolvconf
@@ -35,18 +35,22 @@
# Platform specific kludges
if [ -z "$named_service" -a -z "$named_restart" -a \
- -d "@RCDIR@" -a ! -x "@RCDIR@"/named ]
+ -d "$RCDIR" -a ! -x "$RCDIR"/named ]
then
- if [ -x "@RCDIR@"/bind9 ]; then
+ if [ -x "$RCDIR"/bind9 ]; then
# Debian and derivatives
named_service=bind9
- elif [ -x "@RCDIR@"/rc.bind ]; then
+ elif [ -x "$RCDIR"/rc.bind ]; then
# Slackware
named_service=rc.bind
fi
fi
: ${named_service:=named}
-: ${named_restart:=@RESTARTCMD ${named_service}@}
+
+: ${named_pid:=/var/run/$named_service.pid}
+[ -s "$named_pid" ] || named_pid=/var/run/$named_service/$named_service.pid
+[ -s "$named_pid" ] || unset named_pid
+
newoptions="# Generated by resolvconf$NL"
newzones="$newoptions"
@@ -101,6 +105,14 @@
fi
fi
+# named does not seem to work with SIGHUP which is a same
if $changed; then
- eval $named_restart
+ if [ -n "$named_restart" ]; then
+ eval $named_restart
+ elif [ -n "$RESTARTCMD" ]; then
+ set -- ${named_service}
+ eval $RESTARTCMD
+ else
+ @SBINDIR@/resolvconf -r ${named_service}
+ fi
fi
diff -r 52ddedb968ad -r 158cb30f2e83 external/bsd/openresolv/dist/resolvconf.in
--- a/external/bsd/openresolv/dist/resolvconf.in Mon Apr 11 09:21:18 2016 +0000
+++ b/external/bsd/openresolv/dist/resolvconf.in Mon Apr 11 10:40:21 2016 +0000
@@ -25,9 +25,12 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
RESOLVCONF="$0"
+OPENRESOLV_VERSION="3.8.0"
SYSCONFDIR=@SYSCONFDIR@
LIBEXECDIR=@LIBEXECDIR@
VARDIR=@VARDIR@
+RCDIR=@RCDIR@
+RESTARTCMD=@RESTARTCMD@
# Disregard dhcpcd setting
unset interface_order state_dir
@@ -71,55 +74,45 @@
usage()
{
cat <<-EOF
- Usage: ${RESOLVCONF##*/} [options]
+ Usage: ${RESOLVCONF##*/} [options] command [argument]
Inform the system about any DNS updates.
- Options:
+ Commands:
-a \$INTERFACE Add DNS information to the specified interface
(DNS supplied via stdin in resolv.conf format)
+ -d \$INTERFACE Delete DNS information from the specified interface
+ -h Show this help cruft
+ -i [\$PATTERN] Show interfaces that have supplied DNS information
+ optionally from interfaces that match the specified
+ pattern
+ -l [\$PATTERN] Show DNS information, optionally from interfaces
+ that match the specified pattern
+
+ -u Run updates from our current DNS information
+
+ Options:
+ -f Ignore non existant interfaces
-m metric Give the added DNS information a metric
-p Mark the interface as private
-x Mark the interface as exclusive
- -d \$INTERFACE Delete DNS information from the specified interface
- -f Ignore non existant interfaces
+
+ Subscriber and System Init Commands:
-I Init the state dir
- -u Run updates from our current DNS information
- -l [\$PATTERN] Show DNS information, optionally from interfaces
- that match the specified pattern
- -i [\$PATTERN] Show interfaces that have supplied DNS information
- optionally from interfaces that match the specified
- pattern
+ -r \$SERVICE Restart the system service
+ (restarting a non-existent or non-running service
+ should have no output and return 0)
+ -R Show the system service restart command
-v [\$PATTERN] echo NEWDOMAIN, NEWSEARCH and NEWNS variables to
the console
- -h Show this help cruft
+ -V [\$PATTERN] Same as -v, but only uses configuration in
+ $SYSCONFDIR/resolvconf.conf
EOF
[ -z "$1" ] && exit 0
echo
error_exit "$*"
}
-echo_resolv()
-{
- local line= OIFS="$IFS"
-
- [ -n "$1" -a -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.
- # So we remove them when echoing them.
- while read -r line; do
- IFS="$OIFS"
- if [ -n "$line" ]; then
- # We need to set IFS here to preserve any whitespace
- IFS=''
- printf "%s\n" "$line"
- fi
- done < "$IFACEDIR/$1"
- echo
- IFS="$OIFS"
-}
-
# Strip any trailing dot from each name as a FQDN does not belong
# in resolv.conf(5)
# If you think otherwise, capture a DNS trace and you'll see libc
@@ -127,10 +120,11 @@
# This also solves setting up duplicate zones in our subscribers.
strip_trailing_dots()
{
- local n=
+ local n= d=
for n; do
- printf "%s" "${n%.}"
+ printf "$d%s" "${n%.}"
+ d=" "
done
printf "\n"
}
@@ -260,6 +254,108 @@
return $e
}
+# With the advent of alternative init systems, it's possible to have
+# more than one installed. So we need to try and guess what one we're
+# using unless overriden by configure.
+# Note that restarting a service is a last resort - the subscribers
+# should make a reasonable attempt to reconfigre the service via some
+# method, normally SIGHUP.
+detect_init()
+{
+ [ -n "$RESTARTCMD" ] && return 0
+
+ # Detect the running init system.
+ # As systemd and OpenRC can be installed on top of legacy 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; 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
+ /usr/bin/systemctl restart \$1.service;
+fi"
+ elif [ -x /sbin/rc-service -a \
+ -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ]
+ then
+ 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"
+ elif [ -x /sbin/service ]; then
+ # Old RedHat
+ RCDIR=/etc/init.d
+ 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"
+ elif [ -x /bin/sv ]; then
+ RESTARTCMD="/bin/sv try-restart \$1"
+ elif [ -x /usr/bin/sv ]; then
+ RESTARTCMD="/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
+ /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
+ # OpenBSD
+ RESTARTCMD="if /etc/rc.d/\$1 check 1>/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;
Home |
Main Index |
Thread Index |
Old Index