1 --- busybox-1.00/.pc/udhcpscript.patch/examples/udhcp/simple.script 2004-10-13 00:18:05.000000000 -0700
2 +++ busybox-1.00/examples/udhcp/simple.script 2005-06-05 15:08:28.432605118 -0700
5 +# openslug UDHCP client script
6 +# this must set the HW address (MAC) on the interface
8 +. /etc/default/functions
10 -# udhcpc script edited by Tim Riker <Tim@Rikers.org>
12 -[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
19 + echo "nameserver $dns"
24 +# Output the correct contents for resolv.conf
26 + test -n "$domain" && echo "search $domain"
30 +# checksum of a file (or stdin if -)
32 + md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p'
36 + local B N metric i olddomain
38 + test -n "$broadcast" && B="broadcast $broadcast"
40 + test -n "$subnet" && N="netmask $subnet"
41 + ifconfig "$interface" "$ip" $B $N up
43 + # If given router information delete the old information and
44 + # enter new stuff, routers get metrics incremented by 1
45 + # between each (this is somewhat arbitrary)
46 + if test -n "$router"
48 + while route del default gw 0.0.0.0 dev $interface 2>/dev/null
53 -RESOLV_CONF="/etc/resolv.conf"
54 -[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
55 -[ -n "$subnet" ] && NETMASK="netmask $subnet"
59 + route add default gw "$i" dev "$interface" metric $((metric++))
64 + test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)"
65 + if test -n "$domain" -a "$domain" != "$olddomain"
67 + echo "$domain" >/etc/defaultdomain
68 + # and update the kernel view too
69 + echo "$domain" >/proc/sys/kernel/domainname
72 + # Update /etc/resolv.conf to reflect domain and dns information,
73 + # this always clears resolv.conf if none is given
74 + md5old="$(md5strm /etc/resolv.conf)"
75 + md5new="$(mkresolv | md5strm -)"
76 + test "$md5old" != "$md5new" && mkresolv >/etc/resolv.conf
81 - /sbin/ifconfig $interface 0.0.0.0
85 - /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
87 - if [ -n "$router" ] ; then
88 - echo "deleting routers"
89 - while route del default gw 0.0.0.0 dev $interface ; do
94 - for i in $router ; do
95 - route add default gw $i dev $interface metric $((metric++))
98 + # Bring the interface up (without inet at this point)
99 + ifconfig "$interface" up;;
105 + # Pull the values from the config data if (only only if) this
106 + # is the config interface
107 + if test "$interface" = "$(config iface)"
112 + router="$(config gateway)"
113 + subnet="$(config netmask)"
114 + broadcast="$(config broadcast)"
115 + domain="$(config domain)"
116 + dns="$(config dns)"
122 - echo -n > $RESOLV_CONF
123 - [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
126 - echo nameserver $i >> $RESOLV_CONF
129 +*) echo "udhcpc: $*: unknown command" >&2