Annotation of /trunk/mkinitrd-magellan/busybox/examples/udhcp/simple.script
Parent Directory | Revision Log
Revision 984 -
(hide annotations)
(download)
Sun May 30 11:32:42 2010 UTC (14 years ago) by niro
File size: 1074 byte(s)
Sun May 30 11:32:42 2010 UTC (14 years ago) by niro
File size: 1074 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 | niro | 532 | #!/bin/sh |
2 | # udhcpc script edited by Tim Riker <Tim@Rikers.org> | ||
3 | |||
4 | niro | 984 | RESOLV_CONF="/etc/resolv.conf" |
5 | niro | 532 | |
6 | niro | 984 | [ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; } |
7 | |||
8 | NETMASK="" | ||
9 | [ -n "$subnet" ] && NETMASK="netmask $subnet" | ||
10 | BROADCAST="broadcast +" | ||
11 | niro | 532 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" |
12 | |||
13 | case "$1" in | ||
14 | deconfig) | ||
15 | niro | 984 | echo "Setting IP address 0.0.0.0 on $interface" |
16 | ifconfig $interface 0.0.0.0 | ||
17 | niro | 532 | ;; |
18 | |||
19 | renew|bound) | ||
20 | niro | 984 | echo "Setting IP address $ip on $interface" |
21 | ifconfig $interface $ip $NETMASK $BROADCAST | ||
22 | niro | 532 | |
23 | if [ -n "$router" ] ; then | ||
24 | niro | 984 | echo "Deleting routers" |
25 | niro | 532 | while route del default gw 0.0.0.0 dev $interface ; do |
26 | : | ||
27 | done | ||
28 | |||
29 | metric=0 | ||
30 | for i in $router ; do | ||
31 | niro | 984 | echo "Adding router $i" |
32 | niro | 532 | route add default gw $i dev $interface metric $((metric++)) |
33 | done | ||
34 | fi | ||
35 | |||
36 | niro | 984 | echo "Recreating $RESOLV_CONF" |
37 | echo -n > $RESOLV_CONF-$$ | ||
38 | [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$ | ||
39 | niro | 532 | for i in $dns ; do |
40 | niro | 984 | echo " Adding DNS server $i" |
41 | echo "nameserver $i" >> $RESOLV_CONF-$$ | ||
42 | niro | 532 | done |
43 | niro | 984 | mv $RESOLV_CONF-$$ $RESOLV_CONF |
44 | niro | 532 | ;; |
45 | esac | ||
46 | |||
47 | exit 0 |