Initial commit
This commit is contained in:
50
dhcp/dhclient-enter-hooks.d/resolvconf
Normal file
50
dhcp/dhclient-enter-hooks.d/resolvconf
Normal file
@@ -0,0 +1,50 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user