diff options
Diffstat (limited to 'meta/packages/busybox/busybox-1.01/slugos/udhcpscript.patch')
-rw-r--r-- | meta/packages/busybox/busybox-1.01/slugos/udhcpscript.patch | 162 |
1 files changed, 0 insertions, 162 deletions
diff --git a/meta/packages/busybox/busybox-1.01/slugos/udhcpscript.patch b/meta/packages/busybox/busybox-1.01/slugos/udhcpscript.patch deleted file mode 100644 index 277a22cddb..0000000000 --- a/meta/packages/busybox/busybox-1.01/slugos/udhcpscript.patch +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | diff -rup busybox-1.01/.pc/udhcpscript.patch/examples/udhcp/simple.script busybox-1.01/examples/udhcp/simple.script | ||
2 | --- busybox-1.01/examples/udhcp/simple.script 1970-01-01 00:00:00.000000000 +0000 | ||
3 | +++ busybox-1.01/examples/udhcp/simple.script 1970-01-01 00:00:00.000000000 +0000 | ||
4 | @@ -1,40 +1,129 @@ | ||
5 | #!/bin/sh | ||
6 | +# slugos UDHCP client script | ||
7 | +# | ||
8 | +. /etc/default/functions | ||
9 | + | ||
10 | +echodns(){ | ||
11 | + local dns | ||
12 | + if test $# -gt 0 | ||
13 | + then | ||
14 | + for dns in "$@" | ||
15 | + do | ||
16 | + echo "nameserver $dns #dhcp:$interface" | ||
17 | + done | ||
18 | + fi | ||
19 | +} | ||
20 | |||
21 | -# udhcpc script edited by Tim Riker <Tim@Rikers.org> | ||
22 | +# Output the correct contents for resolv.conf based on | ||
23 | +# the current one and any new information | ||
24 | +mkresolv() { | ||
25 | + local rmdomain | ||
26 | + rmdomain= | ||
27 | + # last search takes precedence, so a user | ||
28 | + # specified search in resolv.conf is retained | ||
29 | + test -n "$domain" && { | ||
30 | + echo "search $domain #dhcp" | ||
31 | + rmdomain='|search [^ ]* #dhcp' | ||
32 | + } | ||
33 | + # first nameserver takes precedence, use a user | ||
34 | + # specified nameserver in preference then the | ||
35 | + # new ones | ||
36 | + egrep -v '^(nameserver [^ ]* #dhcp:.*'"$rmdomain"')$' "$1" | ||
37 | + echodns $dns | ||
38 | + egrep '^nameserver [^ ]* #dhcp:.*$' "$1" | egrep -v :"$interface"'$' | ||
39 | +} | ||
40 | + | ||
41 | +# checksum of a file (or stdin if -) | ||
42 | +md5strm() { | ||
43 | + md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p' | ||
44 | +} | ||
45 | + | ||
46 | +# update resolv.conf for $interface using $domain and $dns | ||
47 | +updresolv() { | ||
48 | + local md5old md5new resolv | ||
49 | + md5old="$(md5strm /etc/resolv.conf)" | ||
50 | + resolv="$(mkresolv /etc/resolv.conf)" | ||
51 | + md5new="$(echo "$resolv" | md5strm -)" | ||
52 | + test "$md5old" != "$md5new" && echo "$resolv" >/etc/resolv.conf | ||
53 | +} | ||
54 | + | ||
55 | +unroute() { | ||
56 | + # called to deconfig the interface | ||
57 | + while route del default gw 0.0.0.0 dev $interface 2>/dev/null | ||
58 | + do | ||
59 | + : | ||
60 | + done | ||
61 | +} | ||
62 | + | ||
63 | +bind() { | ||
64 | + local B N metric i olddomain resolv | ||
65 | + B= | ||
66 | + test -n "$broadcast" && B="broadcast $broadcast" | ||
67 | + N= | ||
68 | + test -n "$subnet" && N="netmask $subnet" | ||
69 | + ifconfig "$interface" "$ip" $B $N up | ||
70 | + | ||
71 | + # If given router information delete the old information and | ||
72 | + # enter new stuff, routers get metrics incremented by 1 | ||
73 | + # between each (this is somewhat arbitrary) | ||
74 | + if test -n "$router" | ||
75 | + then | ||
76 | + unroute | ||
77 | + metric=0 | ||
78 | + for i in $router | ||
79 | + do | ||
80 | + route add default gw "$i" dev "$interface" metric $((metric++)) | ||
81 | + done | ||
82 | + fi | ||
83 | |||
84 | -[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 | ||
85 | + olddomain= | ||
86 | + test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)" | ||
87 | + if test -n "$domain" -a "$domain" != "$olddomain" | ||
88 | + then | ||
89 | + echo "$domain" >/etc/defaultdomain | ||
90 | + # and update the kernel view too | ||
91 | + echo "$domain" >/proc/sys/kernel/domainname | ||
92 | + fi | ||
93 | |||
94 | -RESOLV_CONF="/etc/resolv.conf" | ||
95 | -[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" | ||
96 | -[ -n "$subnet" ] && NETMASK="netmask $subnet" | ||
97 | + updresolv | ||
98 | +} | ||
99 | |||
100 | case "$1" in | ||
101 | - deconfig) | ||
102 | - /sbin/ifconfig $interface 0.0.0.0 | ||
103 | - ;; | ||
104 | - | ||
105 | - renew|bound) | ||
106 | - /sbin/ifconfig $interface $ip $BROADCAST $NETMASK | ||
107 | - | ||
108 | - if [ -n "$router" ] ; then | ||
109 | - echo "deleting routers" | ||
110 | - while route del default gw 0.0.0.0 dev $interface ; do | ||
111 | - : | ||
112 | - done | ||
113 | - | ||
114 | - metric=0 | ||
115 | - for i in $router ; do | ||
116 | - route add default gw $i dev $interface metric $((metric++)) | ||
117 | - done | ||
118 | +deconfig) | ||
119 | + # Bring the interface up (without inet at this point) | ||
120 | + # Remove the resolver information because deconfig is called | ||
121 | + # on leasefail and we need to remove this interface at that | ||
122 | + # point to ensure the machine remains visible on another | ||
123 | + # interface! | ||
124 | + domain= | ||
125 | + dns= | ||
126 | + unroute | ||
127 | + updresolv | ||
128 | + ifconfig "$interface" up;; | ||
129 | + | ||
130 | +renew|bound) | ||
131 | + bind;; | ||
132 | + | ||
133 | +leasefail) | ||
134 | + # Pull the values from the config data if (only only if) this | ||
135 | + # is the config interface | ||
136 | + if test "$interface" = "$(config iface)" | ||
137 | + then | ||
138 | + ip="$(config ip)" | ||
139 | + if test -n "$ip" | ||
140 | + then | ||
141 | + router="$(config gateway)" | ||
142 | + subnet="$(config netmask)" | ||
143 | + broadcast="$(config broadcast)" | ||
144 | + domain="$(config domain)" | ||
145 | + dns="$(config dns)" | ||
146 | + | ||
147 | + bind | ||
148 | fi | ||
149 | + fi;; | ||
150 | |||
151 | - echo -n > $RESOLV_CONF | ||
152 | - [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF | ||
153 | - for i in $dns ; do | ||
154 | - echo adding dns $i | ||
155 | - echo nameserver $i >> $RESOLV_CONF | ||
156 | - done | ||
157 | - ;; | ||
158 | +*) echo "udhcpc: $*: unknown command" >&2 | ||
159 | + exit 1;; | ||
160 | esac | ||
161 | |||
162 | exit 0 | ||