wok-stable view busybox/stuff/udhcp.script @ rev 1770
busybox udhcpc/zcip: call /etc/ip*.d scripts
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Nov 26 18:02:56 2008 +0000 (2008-11-26) |
parents | |
children | bc79e85a1561 |
line source
1 #!/bin/sh
3 # udhcpc script edited by Tim Riker <Tim@Rikers.org>
5 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
7 RESOLV_CONF="/etc/resolv.conf"
8 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
9 [ -n "$subnet" ] && NETMASK="netmask $subnet"
11 case "$1" in
12 deconfig)
13 /sbin/ifconfig $interface 0.0.0.0
14 for i in /etc/ipdown.d/*; do
15 [ -e $i ] && . $i $interface
16 done
17 ;;
19 renew|bound)
20 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
22 if [ -n "$router" ] ; then
23 echo "deleting routers"
24 while route del default gw 0.0.0.0 dev $interface ; do
25 :
26 done
28 metric=0
29 for i in $router ; do
30 route add default gw $i dev $interface metric $((metric++))
31 done
32 fi
34 echo -n > $RESOLV_CONF
35 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
36 for i in $dns ; do
37 echo adding dns $i
38 echo nameserver $i >> $RESOLV_CONF
39 done
40 for i in /etc/ipup.d/*; do
41 [ -e $i ] && . $i $interface $ip $dns
42 done
43 ;;
44 esac
46 exit 0