Use resolvconf(8) to create /etc/resolv.conf, not directly overwrite it.
Approved by: re (kib)
This commit is contained in:
parent
f8c5f6a6b8
commit
33b9d9a8d2
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
# PROVIDE: resolv
|
||||
# REQUIRE: netif
|
||||
# REQUIRE: netif var
|
||||
# KEYWORD: nojail
|
||||
|
||||
. /etc/rc.subr
|
||||
@ -41,17 +41,17 @@ load_rc_config $name
|
||||
# if the info is available via dhcp/kenv
|
||||
# build the resolv.conf
|
||||
#
|
||||
if [ ! -e /etc/resolv.conf -a \
|
||||
-n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then
|
||||
> /etc/resolv.conf
|
||||
|
||||
if [ -n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then
|
||||
interface="`/bin/kenv boot.netif.name`"
|
||||
(
|
||||
if [ -n "`/bin/kenv dhcp.domain-name 2> /dev/null`" ]; then
|
||||
echo domain `/bin/kenv dhcp.domain-name` > /etc/resolv.conf
|
||||
echo domain `/bin/kenv dhcp.domain-name`
|
||||
fi
|
||||
|
||||
set -- `/bin/kenv dhcp.domain-name-servers`
|
||||
for ns in `IFS=','; echo $*`; do
|
||||
echo nameserver $ns >> /etc/resolv.conf;
|
||||
echo nameserver $ns
|
||||
done
|
||||
) | /sbin/resolvconf -a ${interface}:dhcp4
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user