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

ppp: build rp-pppoe.so (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 25 11:15:26 2012 +0100 (2012-02-25)
parents 1ed09465c0ae
children 15a917692a49
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/ipv6 weirdness
8 RESOLV_CONF="/etc/resolv.conf"
9 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
10 [ -n "$subnet" ] && NETMASK="netmask $subnet"
12 netfs()
13 {
14 /bin/grep -qe '\(:.* /\|httpfs\)' /proc/mounts
15 }
17 case "$1" in
18 deconfig)
19 netfs || /sbin/ifconfig $interface 0.0.0.0
20 for i in /etc/ipdown.d/*; do
21 [ -x $i ] && $i $interface
22 done
23 ;;
25 renew|bound)
26 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
28 if [ -n "$router" ] ; then
29 echo "deleting routers"
30 while route del default gw 0.0.0.0 dev $interface ; do
31 :
32 done
34 metric=0
35 for i in $router ; do
36 route add default gw $i dev $interface metric $((metric++))
37 done
38 fi
40 echo -n > $RESOLV_CONF
41 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
42 for i in $dns ; do
43 echo adding dns $i
44 echo nameserver $i >> $RESOLV_CONF
45 done
46 [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do
47 [ -x $i ] && $i $interface $ip $dns
48 done
49 ;;
50 esac
52 exit 0