wok view busybox/stuff/udhcp.script @ rev 8335

tazpkg now depends on libtaz
author Antoine Bodin <gokhlayeh@slitaz.org>
date Wed Feb 02 00:58:48 2011 +0100 (2011-02-02)
parents bc79e85a1561
children 127ec27f61ab
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 [ "$subnet" == "255.255.255.255" ] && subnet="255.255.0.0" # qemu weirdness
8 RESOLV_CONF="/etc/resolv.conf"
9 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
10 [ -n "$subnet" ] && NETMASK="netmask $subnet"
12 case "$1" in
13 deconfig)
14 /sbin/ifconfig $interface 0.0.0.0
15 for i in /etc/ipdown.d/*; do
16 [ -x $i ] && $i $interface
17 done
18 ;;
20 renew|bound)
21 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
23 if [ -n "$router" ] ; then
24 echo "deleting routers"
25 while route del default gw 0.0.0.0 dev $interface ; do
26 :
27 done
29 metric=0
30 for i in $router ; do
31 route add default gw $i dev $interface metric $((metric++))
32 done
33 fi
35 echo -n > $RESOLV_CONF
36 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
37 for i in $dns ; do
38 echo adding dns $i
39 echo nameserver $i >> $RESOLV_CONF
40 done
41 [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do
42 [ -x $i ] && $i $interface $ip $dns
43 done
44 ;;
45 esac
47 exit 0