aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-16 20:04:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-16 20:04:09 +0000
commitea4f0847c3d765a782eb9afe3b0f9fb0659cd1bc (patch)
treebe7e5d8d60f7873daf7855aacaa83c22bdbcad4b
parentfa4ca7889e35036c3c62a0fba3309b8e158fd4cd (diff)
downloadbusybox-w32-ea4f0847c3d765a782eb9afe3b0f9fb0659cd1bc.tar.gz
busybox-w32-ea4f0847c3d765a782eb9afe3b0f9fb0659cd1bc.tar.bz2
busybox-w32-ea4f0847c3d765a782eb9afe3b0f9fb0659cd1bc.zip
update example udhcpc script
-rw-r--r--examples/udhcp/simple.script23
1 files changed, 15 insertions, 8 deletions
diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script
index 98ebc159f..ae0931640 100644
--- a/examples/udhcp/simple.script
+++ b/examples/udhcp/simple.script
@@ -5,35 +5,42 @@
5[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 5[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
6 6
7RESOLV_CONF="/etc/resolv.conf" 7RESOLV_CONF="/etc/resolv.conf"
8[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" 8NETMASK=""
9[ -n "$subnet" ] && NETMASK="netmask $subnet" 9[ -n "$subnet" ] && NETMASK="netmask $subnet"
10BROADCAST="broadcast +"
11[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
10 12
11case "$1" in 13case "$1" in
12 deconfig) 14 deconfig)
13 /sbin/ifconfig $interface 0.0.0.0 15 echo "Setting IP address 0.0.0.0 on $interface"
16 ifconfig $interface 0.0.0.0
14 ;; 17 ;;
15 18
16 renew|bound) 19 renew|bound)
17 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK 20 echo "Setting IP address $ip on $interface"
21 ifconfig $interface $ip $NETMASK $BROADCAST
18 22
19 if [ -n "$router" ] ; then 23 if [ -n "$router" ] ; then
20 echo "deleting routers" 24 echo "Deleting routers"
21 while route del default gw 0.0.0.0 dev $interface ; do 25 while route del default gw 0.0.0.0 dev $interface ; do
22 : 26 :
23 done 27 done
24 28
25 metric=0 29 metric=0
26 for i in $router ; do 30 for i in $router ; do
31 echo "Adding router $i"
27 route add default gw $i dev $interface metric $((metric++)) 32 route add default gw $i dev $interface metric $((metric++))
28 done 33 done
29 fi 34 fi
30 35
31 echo -n > $RESOLV_CONF 36 echo "Recreating $RESOLV_CONF"
32 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF 37 echo -n > $RESOLV_CONF-$$
38 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF-$$
33 for i in $dns ; do 39 for i in $dns ; do
34 echo adding dns $i 40 echo " Adding DNS server $i"
35 echo nameserver $i >> $RESOLV_CONF 41 echo nameserver $i >> $RESOLV_CONF-$$
36 done 42 done
43 mv $RESOLV_CONF-$$ $RESOLV_CONF
37 ;; 44 ;;
38esac 45esac
39 46