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

Up slitaz-boot-scripts (5.3.2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 30 18:29:11 2013 +0100 (2013-10-30)
parents 15a917692a49
children 15e6c6910ee3
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\|nfs\|smbfs\|ncp\|coda\)' /proc/mounts
15 }
17 logger "$0 interface=$interface ip=$ip broadcast=$broadcast subnet=$subnet router=$router domain=$domain dns=$dns $@"
19 case "$1" in
20 deconfig)
21 netfs || /sbin/ifconfig $interface 0.0.0.0
22 for i in /etc/ipdown.d/*; do
23 [ -x $i ] && $i $interface
24 done
25 ;;
27 renew|bound)
28 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
30 if [ -n "$router" ] ; then
31 echo "deleting routers"
32 while route del default gw 0.0.0.0 dev $interface 2>/dev/null; do
33 :
34 done
36 metric=0
37 for i in $router ; do
38 route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
39 done
40 fi
42 echo -n > $RESOLV_CONF
43 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
44 for i in $dns ; do
45 echo adding dns $i
46 echo nameserver $i >> $RESOLV_CONF
47 done
48 [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do
49 [ -x $i ] && $i $interface $ip $dns
50 done
51 ;;
52 esac
54 exit 0