51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
# resolvconf support for dhclient3
|
|
|
|
NL="
|
|
"
|
|
|
|
if [ -x /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" | \
|
|
/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" | \
|
|
/sbin/resolvconf -a "$interface.inet6"
|
|
fi
|
|
}
|
|
;;
|
|
EXPIRE|FAIL|RELEASE|STOP)
|
|
[ -z "$interface" ] || /sbin/resolvconf -f -d "$interface"
|
|
;;
|
|
EXPIRE6|RELEASE6|STOP6)
|
|
[ -z "$interface" ] || /sbin/resolvconf -f -d "$interface.inet6"
|
|
;;
|
|
esac
|
|
fi
|