|
@@ -1,14 +1,25 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
|
+# This script is called with the following arguments:
|
|
|
|
+# Arg Name Example
|
|
|
|
+# $1 Interface name ppp0
|
|
|
|
+# $2 The tty ttyO1
|
|
|
|
+# $3 The link speed 38400
|
|
|
|
+# $4 Local IP number 12.34.56.78
|
|
|
|
+# $5 Peer IP number 12.34.56.99
|
|
|
|
+# $6 Optional ``ipparam'' value foo
|
|
|
|
+
|
|
WRKPATH=/etc/ppp
|
|
WRKPATH=/etc/ppp
|
|
DESTFILE=/etc/resolv.conf
|
|
DESTFILE=/etc/resolv.conf
|
|
|
|
|
|
if [ -e "$WRKPATH/resolv.conf" ]; then
|
|
if [ -e "$WRKPATH/resolv.conf" ]; then
|
|
|
|
|
|
|
|
+ /bin/sed --follow-symlinks -i "/\# $1/d" $DESTFILE
|
|
|
|
+
|
|
readarray -t DNSSERVERS < <(cat $WRKPATH/resolv.conf)
|
|
readarray -t DNSSERVERS < <(cat $WRKPATH/resolv.conf)
|
|
|
|
|
|
for DNS in "${DNSSERVERS[@]}"; do
|
|
for DNS in "${DNSSERVERS[@]}"; do
|
|
if [[ -z $(/bin/grep "$DNS" "$DESTFILE") ]]; then
|
|
if [[ -z $(/bin/grep "$DNS" "$DESTFILE") ]]; then
|
|
- /bin/sed --follow-symlinks -i "1 s/^/$DNS\n/" $DESTFILE
|
|
|
|
|
|
+ /bin/sed --follow-symlinks -i "1 s/^/$DNS \# $1\n/" $DESTFILE
|
|
# echo "$DNS" #>> $DESTFILE
|
|
# echo "$DNS" #>> $DESTFILE
|
|
fi
|
|
fi
|
|
done
|
|
done
|