#!/bin/sh # 0dns-up by John Hasler 4 Apr 1999. You may treat this program as if it # was in the public domain. # Rev. Dec 22 1999 to put dynaminc nameservers last. # Rev. Aug 20 2001 to use patch from Sergio Gelato . # 0dns-up sets up /etc/resolv.conf for the provider being connected to. In # conjunction with pppd's usepeerdns option it also handles dynamic dns. # It expects to be passed the provider name in PPP_IPPARAM. # If pppconfig has been removed we are not supposed to do anything. test -f /usr/sbin/pppconfig || exit 0 PROVIDER="$PPP_IPPARAM" ETC="/etc" PPPRESOLV="$ETC/ppp/resolv" RESOLVCONF="resolv.conf-dnsmasq" # Security: we sit in the $ETC directory while we do our work. cd "$ETC" || exit 1 # Put the resolv.conf for this provider (if it exists) in a temp file. # If we are using dynamic dns it will be empty or contain any resolver # options the user added. Otherwise it will be a complete resolv.conf for # this provider. # Security: make sure the temp file has the right permissions from the outset. # This script should run as root, and . should only be writable by root. test -f $RESOLVCONF && /bin/rm -f $REDOLVCONF umask 022 # We trust $PPPRESOLV/$PROVIDER. test -f "$PPPRESOLV/$PROVIDER" && cat $PPPRESOLV/$PROVIDER > $RESOLVCONF # USEPEERDNS, DNS1, and DNS2 are variables exported by pppd. Do we have # usepeerdns and a couple of nameservers? If so, put a couple of # nameserver lines in the temp file. if [ "$USEPEERDNS" ] && [ "$DNS1" ] ; then echo "" >> $RESOLVCONF echo "nameserver $DNS1" >> $RESOLVCONF if [ "$DNS2" ] ; then echo "" >> $RESOLVCONF echo "nameserver $DNS2" >> $RESOLVCONF fi fi exit 0