File: dhclient

package info (click to toggle)
openresolv 3.13.2-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 244 kB
  • sloc: sh: 1,778; makefile: 124
file content (50 lines) | stat: -rw-r--r-- 1,316 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# resolvconf support for dhclient3

NL="
"

if [ -x /usr/sbin/resolvconf ]; then
	case "$reason" in
	BOUND|RENEW|REBIND|REBOOT|TIMEOUT)	
		make_resolv_conf() {
			local nameserver conf=
			if [ -n "$new_domain_name" ]; then
				conf="${conf}domain $new_domain_name$NL"
			fi
			if [ -n "$new_domain_search" ]; then
				conf="${conf}search $new_domain_search$NL"
			fi
			for nameserver in $new_domain_name_servers; do
				conf="${conf}nameserver $nameserver$NL"
			done
			if [ -n "$conf" -a -n "$interface" ]; then
				conf="# resolv.conf for $interface$NL$conf"
				printf %s "$conf" | \
					/usr/sbin/resolvconf -a "$interface"
			fi
		}
		;;
	BOUND6|RENEW6|REBIND6)
		make_resolv_conf() {
			local nameserver conf=
			if [ -n "$new_dhcp6_domain_search" ]; then
				conf="${conf}search $new_dhcp6_domain_search$NL"
			fi
			for nameserver in $new_dhcp6_name_servers; do
				conf="${conf}nameserver $nameserver$NL"
			done
			if [ -n "$conf" -a -n "$interface" ]; then
				conf="# resolv.conf for $interface$NL$conf"
				printf %s "$conf" | \
					/usr/sbin/resolvconf -a "$interface.inet6"
			fi
		}
		;;
	EXPIRE|FAIL|RELEASE|STOP)
		[ -z "$interface" ] || /usr/sbin/resolvconf -f -d "$interface"
		;;
	EXPIRE6|RELEASE6|STOP6)
		[ -z "$interface" ] || /usr/sbin/resolvconf -f -d "$interface.inet6"
		;;
	esac
fi