Glenn L McGrath | 419eed7 | 2002-08-21 14:24:38 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # Sample udhcpc renew script |
| 3 | |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 4 | RESOLV_CONF="/etc/udhcpc/resolv.conf" |
Glenn L McGrath | 419eed7 | 2002-08-21 14:24:38 +0000 | [diff] [blame] | 5 | |
| 6 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" |
| 7 | [ -n "$subnet" ] && NETMASK="netmask $subnet" |
| 8 | |
| 9 | /sbin/ifconfig $interface $ip $BROADCAST $NETMASK |
| 10 | |
| 11 | if [ -n "$router" ] |
| 12 | then |
| 13 | echo "deleting routers" |
| 14 | while /sbin/route del default gw 0.0.0.0 dev $interface |
| 15 | do : |
| 16 | done |
| 17 | |
Eric Andersen | 1aee3ff | 2004-10-13 07:18:05 +0000 | [diff] [blame] | 18 | metric=0 |
Glenn L McGrath | 419eed7 | 2002-08-21 14:24:38 +0000 | [diff] [blame] | 19 | for i in $router |
| 20 | do |
Eric Andersen | 1aee3ff | 2004-10-13 07:18:05 +0000 | [diff] [blame] | 21 | /sbin/route add default gw $i dev $interface metric $((metric++)) |
Glenn L McGrath | 419eed7 | 2002-08-21 14:24:38 +0000 | [diff] [blame] | 22 | done |
| 23 | fi |
| 24 | |
Denys Vlasenko | 2e66dac | 2014-01-13 13:38:53 +0100 | [diff] [blame^] | 25 | # Only replace resolv.conf is we have at least one DNS server |
| 26 | if [ -n "$dns" ] |
| 27 | then |
| 28 | echo -n > $RESOLV_CONF |
| 29 | [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF |
| 30 | for i in $dns |
| 31 | do |
| 32 | echo adding dns $i |
| 33 | echo nameserver $i >> $RESOLV_CONF |
| 34 | done |
| 35 | fi |