Lines Matching +full:conf +full:- +full:ds
2 # Copyright (c) 2007-2019 Roy Marples
35 if [ "$1" = "--version" ]; then
37 echo "Copyright (c) 2007-2016 Roy Marples"
47 dynamic_order="tap[0-9]* tun[0-9]* vpn vpn[0-9]* ppp[0-9]* ippp[0-9]*"
48 interface_order="lo lo[0-9]*"
53 if [ -f "$SYSCONFDIR"/resolvconf.conf ]; then
54 . "$SYSCONFDIR"/resolvconf.conf
55 [ -n "$state_dir" ] && VARDIR="$state_dir"
56 elif [ -d "$SYSCONFDIR/resolvconf" ]; then
58 if [ -f "$SYSCONFDIR"/interface-order ]; then
59 interface_order="$(cat "$SYSCONFDIR"/interface-order)"
82 cat <<-EOF
88 -a \$INTERFACE Add DNS information to the specified interface
89 (DNS supplied via stdin in resolv.conf format)
90 -d \$INTERFACE Delete DNS information from the specified interface
91 -h Show this help cruft
92 -i [\$PATTERN] Show interfaces that have supplied DNS information
95 -l [\$PATTERN] Show DNS information, optionally from interfaces
98 -u Run updates from our current DNS information
99 --version Echo the ${RESOLVCONF##*/} version
102 -f Ignore non existent interfaces
103 -m metric Give the added DNS information a metric
104 -p Mark the interface as private
105 -x Mark the interface as exclusive
108 -I Init the state dir
109 -r \$SERVICE Restart the system service
110 (restarting a non-existent or non-running service
112 -R Show the system service restart command
113 -v [\$PATTERN] echo NEWDOMAIN, NEWSEARCH and NEWNS variables to
115 -V [\$PATTERN] Same as -v, but only uses configuration in
116 $SYSCONFDIR/resolvconf.conf
118 [ -z "$1" ] && exit 0
124 # in resolv.conf(5)
154 if [ -e "$PRIVATEDIR/$iface" ]; then
168 # Parse resolv.conf's and make variables
179 while read -r line; do
182 "# resolv.conf from "*)
184 iface="${line#\# resolv.conf from *}"
211 if [ -z "$domain" ]; then
220 [ -n "$line" ] && continue
221 if [ -n "$ns" ] && [ -n "$search" ]; then
226 ds=
228 ds="$ds${ds:+ }$d:$newns"
230 echo "DOMAINS=\"\$DOMAINS $ds\""
247 while [ -n "$1" ]; do
261 set -- $@
263 if [ -n "$1" ]; then
268 while [ -n "$2" ]; do
279 [ -n "$f" ] || continue
281 if [ ! -d "$d" ]; then
283 install -d "$d" || e=$?
295 # Note that restarting a service is a last resort - the subscribers
300 [ -n "$RESTARTCMD" ] && return 0
307 if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then
309 if /bin/systemctl --quiet is-active $1.service
313 elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then
315 if /usr/bin/systemctl --quiet is-active $1.service
319 elif [ -x /sbin/rc-service ] &&
320 { [ -s /libexec/rc/init.d/softlevel ] ||
321 [ -s /run/openrc/softlevel ]; }
323 RESTARTCMD='/sbin/rc-service -i $1 -- -Ds restart'
324 elif [ -x /usr/sbin/invoke-rc.d ]; then
327 if /usr/sbin/invoke-rc.d --quiet $1 status >/dev/null 2>&1
329 /usr/sbin/invoke-rc.d $1 restart
331 elif [ -x /sbin/service ]; then
338 elif [ -x /usr/sbin/service ]; then
345 elif [ -x /bin/sv ]; then
347 /bin/sv try-restart $1'
348 elif [ -x /usr/bin/sv ]; then
350 /usr/bin/sv try-restart $1'
351 elif [ -e /etc/arch-release ] && [ -d /etc/rc.d ]; then
354 if [ -e /var/run/daemons/$1 ]
358 elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then
364 elif [ -e /etc/rc.d/rc.subr ] && [ -d /etc/rc.d ]; then
373 [ -d $x ] || continue
383 if [ -z "$RESTARTCMD" ]; then
398 [ -n "$1" ] && [ -f "$IFACEDIR/$1" ] || return 1
399 echo "# resolv.conf from $1"
400 # Our variable maker works of the fact each resolv.conf per interface
403 while read -r line; do
405 if [ -n "$line" ]; then
416 [ -d "$IFACEDIR" ] || return 0
428 if [ -d "$EXCLUSIVEDIR" ]; then
431 if [ -f "$i" ]; then
439 if [ -f "$i" ] && [ "$list" = "$i" ]; then
450 if [ -n "$1" ]; then
456 [ -f "$i" ] && list="$list $i"
458 [ -f "$ii" ] && list="$list $ii"
462 if [ -e "$i" ] && ! [ -e "$METRICDIR/"*" $i" ]; then
466 if [ -f "$ii" ] && ! [ -e "$METRICDIR/"*" $ii" ]
474 if [ -f "$i" ] && ! [ -e "$METRICDIR/"*" $i" ]; then
478 if [ -d "$METRICDIR" ]; then
481 [ -f "$i" ] && list="$list ${i#* }"
490 if ! [ -f "$i" ]; then
492 echo "No resolv.conf for interface $i" >&2
498 if [ "$cmd" = i ] || [ "$cmd" = "-i" ]; then
505 [ "$cmd" = i ] || [ "$cmd" = "-i" ] && echo
511 [ -z "$2" ] && return 0
517 set -f
540 if [ -n "$search_domains" ]; then
552 if [ -n "$search_domains_append" ]; then
563 while read -r keyword value; do
609 if [ -n "${name_servers}${search_domains}" ]; then
612 if [ -z "$VFLAG" ]; then
614 list_resolv -i "$@" >/dev/null || IF_EXCLUSIVE=0
615 eval "$(list_resolv -l "$@" | replace | parse_resolv)"
617 if [ -n "${name_servers_append}${search_domains_append}" ]; then
633 while [ -n "$ns" ]; do
645 if [ -n "$newns" ]; then
684 shift $(($OPTIND - 1))
687 # -I inits the state dir
689 if [ -d "$VARDIR" ]; then
690 rm -rf "$VARDIR"/*
695 # -D ensures that the listed config file base dirs exist
701 # -l lists our resolv files, optionally for a specific interface
711 set -- $args
715 sed -e '/^$/d' -e 's/^ //g'
721 if [ "$cmd" = v ] || [ -n "$VFLAG" ]; then
728 if [ -z "$iface" ]; then
732 [ -n "$cmd" ] && [ "$cmd" != h ] && usage "Unknown option $cmd"
742 for x in '.' '-' '~'; do
748 [ "$cmd" = a ] && [ -t 0 ] && error_exit "No file given via stdin"
751 if [ ! -d "$VARDIR" ]; then
752 if [ -L "$VARDIR" ]; then
756 if ! mkdir -m 0755 -p "$dir"; then
761 if ! mkdir -m 0755 -p "$VARDIR"; then
768 if [ ! -d "$IFACEDIR" ]; then
769 mkdir -m 0755 -p "$IFACEDIR" || \
776 warn "No resolv.conf for interface $i"
790 [ -w "$VARDIR" ] || error_exit "Cannot write to $LOCKDIR"
794 trap 'rm -rf "$LOCKDIR";' EXIT
795 trap 'rm -rf "$LOCKDIR"; exit 1' INT QUIT ABRT SEGV ALRM TERM
800 if ! kill -0 "$pid"; then
802 rm -rf "$LOCKDIR"
805 lock_timeout=$(($lock_timeout - 1))
806 if [ "$lock_timeout" -le 0 ]; then
814 # Read resolv.conf from stdin
819 if [ -e "$IFACEDIR/$iface" ]; then
831 # Set metric and private before creating the interface resolv.conf file
833 [ ! -d "$METRICDIR" ] && mkdir "$METRICDIR"
836 if [ -n "$IF_METRIC" ]; then
838 while [ ${#IF_METRIC} -le 6 ]; do
843 rm -f "$METRICDIR/"*" $iface"
847 [ -n "$newmetric" ] && echo " " >"$newmetric"
851 if [ ! -d "$PRIVATEDIR" ]; then
852 [ -e "$PRIVATEDIR" ] && rm "$PRIVATEDIR"
855 [ -e "$PRIVATEDIR/$iface" ] || changed=true
856 [ -d "$PRIVATEDIR" ] && echo " " >"$PRIVATEDIR/$iface"
859 if [ -e "$PRIVATEDIR/$iface" ]; then
860 rm -f "$PRIVATEDIR/$iface"
868 if [ -f "$x" ]; then
875 if [ ! -d "$EXCLUSIVEDIR" ]; then
876 [ -e "$EXCLUSIVEDIR" ] && rm "$EXCLUSIVEDIR"
881 [ -f "$x" ] && break
892 x=$(($x - 1))
894 if [ -d "$EXCLUSIVEDIR" ]; then
901 if [ -f "$oldexcl" ]; then
902 rm -f "$oldexcl"
921 if [ -e "$i" ]; then
924 warn "No resolv.conf for interface $i"
926 rm -f "$i" "$METRICDIR/"*" $i" \
939 case "${resolvconf:-YES}" in
950 : ${list_resolv:=list_resolv -l}
957 if [ -f "$script" ]; then
959 case "${script_enabled:-YES}" in
963 if [ -x "$script" ]; then
966 (set -- "$cmd" "$iface"; . "$script")