ppp/ppp-ip-up

25 lines
755 B
Plaintext
Raw Normal View History

#!/bin/bash
#
# This script automatically configure the file resolv.conf for peer supplied
# DNS addresses when using the `usepeerdns' option.
# Based on the example script by Nick Walker (nickwalker@email.com)
#
# Copyright (C) 2005 Davide Madrisan <davide.madrisan@qilinux.it>
if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
rm -f /etc/ppp/resolv.prev
if [ -f /etc/resolv.conf ]; then
cp /etc/resolv.conf /etc/ppp/resolv.prev
echo "\
; generated by /etc/ppp/ip-up
; lock $PPPD_PID" > /etc/resolv.conf
grep domain /etc/ppp/resolv.prev >> /etc/resolv.conf
grep search /etc/ppp/resolv.prev >> /etc/resolv.conf
cat /etc/ppp/resolv.conf >> /etc/resolv.conf
else
cp /etc/ppp/resolv.conf /etc
fi
fi