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

busybox/udhcp.script: add nfs support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 16 13:21:36 2012 +0100 (2012-03-16)
parents 127ec27f61ab
children d83d24e3aa16
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 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 2>/dev/null; do
31 :
32 done
34 metric=0
35 for i in $router ; do
36 route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
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