[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ppp dynamic dns need /etc/resolv.conf to work, a bug?



Pigeon writes:
> Also worth checking /etc/ppp/ip-up.d/000usepeerdns which ought to be
> detecting that you've used pppconfig and leaving all the work to
> .../0-dns-up.

Here is 0000usepeerdns-up:

#!/bin/sh -e

# this variable is only set if the usepeerdns pppd option is being used
[ "$USEPEERDNS" ] || exit 0

# exit if the resolvconf package is installed
[ -x /sbin/resolvconf ] && exit 0

# create the file if it does not exist
if ! [ -e /etc/resolv.conf ]; then
  : > /etc/resolv.conf
fi

# follow any symlink to find the real file
REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)

# merge the new nameservers with the other options from the old configuration
{
  cat /etc/ppp/resolv.conf
  grep --invert-match '^nameserver[[:space:]]' "$REALRESOLVCONF" || true
} > "$REALRESOLVCONF.tmp"

# backup the old configuration and install the new one
cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup"
mv -f "$REALRESOLVCONF.tmp" "$REALRESOLVCONF"

# tell nscd that the file has changed
[ -x /usr/sbin/nscd ] && /usr/sbin/nscd -i hosts || true

exit 0


And 0000usepeerdns-down:

#!/bin/sh -e

# exit if the resolvconf package is installed
[ -x /sbin/resolvconf ] && exit 0

# follow any symlink to find the real file
if [ -e /etc/resolv.conf ]; then
  REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
else
  REALRESOLVCONF=/etc/resolv.conf
fi

# if an old resolv.conf file exists, restore it
if [ -e $REALRESOLVCONF.pppd-backup ]; then
  mv -f $REALRESOLVCONF.pppd-backup $REALRESOLVCONF

  # tell nscd that the file has changed
  [ -x /usr/sbin/nscd ] && /usr/sbin/nscd -i hosts || true
fi

exit 0


-- 
John Hasler



Reply to: