wok-next view busybox/stuff/udhcp.script @ rev 5442
asterisk: use bb/sed
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed May 05 10:47:45 2010 +0200 (2010-05-05) |
parents | b46a95b3d2ee |
children | 1ed09465c0ae |
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 [ -x $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 [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do
41 [ -x $i ] && $i $interface $ip $dns
42 done
43 ;;
44 esac
46 exit 0