aboutsummaryrefslogtreecommitdiff
path: root/examples/udhcp
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 /examples/udhcp
parentfa4ca7889e35036c3c62a0fba3309b8e158fd4cd (diff)
downloadbusybox-ea4f0847c3d765a782eb9afe3b0f9fb0659cd1bc.tar.gz
update example udhcpc script
Diffstat (limited to 'examples/udhcp')
-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 @@
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
-[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+NETMASK=""
[ -n "$subnet" ] && NETMASK="netmask $subnet"
+BROADCAST="broadcast +"
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
case "$1" in
deconfig)
- /sbin/ifconfig $interface 0.0.0.0
+ echo "Setting IP address 0.0.0.0 on $interface"
+ ifconfig $interface 0.0.0.0
;;
renew|bound)
- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+ echo "Setting IP address $ip on $interface"
+ ifconfig $interface $ip $NETMASK $BROADCAST
if [ -n "$router" ] ; then
- echo "deleting routers"
+ echo "Deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
metric=0
for i in $router ; do
+ echo "Adding router $i"
route add default gw $i dev $interface metric $((metric++))
done
fi
- echo -n > $RESOLV_CONF
- [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
+ echo "Recreating $RESOLV_CONF"
+ echo -n > $RESOLV_CONF-$$
+ [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF-$$
for i in $dns ; do
- echo adding dns $i
- echo nameserver $i >> $RESOLV_CONF
+ echo " Adding DNS server $i"
+ echo nameserver $i >> $RESOLV_CONF-$$
done
+ mv $RESOLV_CONF-$$ $RESOLV_CONF
;;
esac