3
# this variable is only set if the usepeerdns pppd option is being used
4
[ "$USEPEERDNS" ] || exit 0
6
# exit if the resolvconf package is installed
7
[ -x /sbin/resolvconf ] && exit 0
9
# create the file if it does not exist
10
if [ ! -e /etc/resolv.conf ]; then
14
# follow any symlink to find the real file
15
REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
17
# merge the new nameservers with the other options from the old configuration
19
cat /etc/ppp/resolv.conf
20
grep --invert-match '^nameserver[[:space:]]' "$REALRESOLVCONF" || true
21
} > "$REALRESOLVCONF.tmp"
23
# backup the old configuration and install the new one
24
cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"
25
mv -f "$REALRESOLVCONF.tmp" "$REALRESOLVCONF"
27
# restart nscd because resolv.conf has changed
28
if [ -e /var/run/nscd.pid ]; then
29
/etc/init.d/nscd restart || true