diff options
Diffstat (limited to 'openembedded/packages/busybox/busybox-1.00/openslug/udhcpscript.patch')
| -rw-r--r-- | openembedded/packages/busybox/busybox-1.00/openslug/udhcpscript.patch | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/openembedded/packages/busybox/busybox-1.00/openslug/udhcpscript.patch b/openembedded/packages/busybox/busybox-1.00/openslug/udhcpscript.patch deleted file mode 100644 index 010f64a53f..0000000000 --- a/openembedded/packages/busybox/busybox-1.00/openslug/udhcpscript.patch +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 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 | ||
| 3 | @@ -1,40 +1,101 @@ | ||
| 4 | #!/bin/sh | ||
| 5 | +# openslug UDHCP client script | ||
| 6 | +# this must set the HW address (MAC) on the interface | ||
| 7 | +# | ||
| 8 | +. /etc/default/functions | ||
| 9 | |||
| 10 | -# udhcpc script edited by Tim Riker <Tim@Rikers.org> | ||
| 11 | |||
| 12 | -[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 | ||
| 13 | +echodns(){ | ||
| 14 | + local dns | ||
| 15 | + if test $# -gt 0 | ||
| 16 | + then | ||
| 17 | + for dns in "$@" | ||
| 18 | + do | ||
| 19 | + echo "nameserver $dns" | ||
| 20 | + done | ||
| 21 | + fi | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +# Output the correct contents for resolv.conf | ||
| 25 | +mkresolv() { | ||
| 26 | + test -n "$domain" && echo "search $domain" | ||
| 27 | + echodns $dns | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +# checksum of a file (or stdin if -) | ||
| 31 | +md5strm() { | ||
| 32 | + md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p' | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +bind() { | ||
| 36 | + local B N metric i olddomain | ||
| 37 | + B= | ||
| 38 | + test -n "$broadcast" && B="broadcast $broadcast" | ||
| 39 | + N= | ||
| 40 | + test -n "$subnet" && N="netmask $subnet" | ||
| 41 | + ifconfig "$interface" "$ip" $B $N up | ||
| 42 | + | ||
| 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" | ||
| 47 | + then | ||
| 48 | + while route del default gw 0.0.0.0 dev $interface 2>/dev/null | ||
| 49 | + do | ||
| 50 | + : | ||
| 51 | + done | ||
| 52 | |||
| 53 | -RESOLV_CONF="/etc/resolv.conf" | ||
| 54 | -[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" | ||
| 55 | -[ -n "$subnet" ] && NETMASK="netmask $subnet" | ||
| 56 | + metric=0 | ||
| 57 | + for i in $router | ||
| 58 | + do | ||
| 59 | + route add default gw "$i" dev "$interface" metric $((metric++)) | ||
| 60 | + done | ||
| 61 | + fi | ||
| 62 | + | ||
| 63 | + olddomain= | ||
| 64 | + test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)" | ||
| 65 | + if test -n "$domain" -a "$domain" != "$olddomain" | ||
| 66 | + then | ||
| 67 | + echo "$domain" >/etc/defaultdomain | ||
| 68 | + # and update the kernel view too | ||
| 69 | + echo "$domain" >/proc/sys/kernel/domainname | ||
| 70 | + fi | ||
| 71 | + | ||
| 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 | ||
| 77 | +} | ||
| 78 | |||
| 79 | case "$1" in | ||
| 80 | - deconfig) | ||
| 81 | - /sbin/ifconfig $interface 0.0.0.0 | ||
| 82 | - ;; | ||
| 83 | - | ||
| 84 | - renew|bound) | ||
| 85 | - /sbin/ifconfig $interface $ip $BROADCAST $NETMASK | ||
| 86 | - | ||
| 87 | - if [ -n "$router" ] ; then | ||
| 88 | - echo "deleting routers" | ||
| 89 | - while route del default gw 0.0.0.0 dev $interface ; do | ||
| 90 | - : | ||
| 91 | - done | ||
| 92 | - | ||
| 93 | - metric=0 | ||
| 94 | - for i in $router ; do | ||
| 95 | - route add default gw $i dev $interface metric $((metric++)) | ||
| 96 | - done | ||
| 97 | +deconfig) | ||
| 98 | + # Bring the interface up (without inet at this point) | ||
| 99 | + ifconfig "$interface" up;; | ||
| 100 | + | ||
| 101 | +renew|bound) | ||
| 102 | + bind;; | ||
| 103 | + | ||
| 104 | +leasefail) | ||
| 105 | + # Pull the values from the config data if (only only if) this | ||
| 106 | + # is the config interface | ||
| 107 | + if test "$interface" = "$(config iface)" | ||
| 108 | + then | ||
| 109 | + ip="$(config ip)" | ||
| 110 | + if test -n "$ip" | ||
| 111 | + then | ||
| 112 | + router="$(config gateway)" | ||
| 113 | + subnet="$(config netmask)" | ||
| 114 | + broadcast="$(config broadcast)" | ||
| 115 | + domain="$(config domain)" | ||
| 116 | + dns="$(config dns)" | ||
| 117 | + | ||
| 118 | + bind | ||
| 119 | fi | ||
| 120 | + fi;; | ||
| 121 | |||
| 122 | - echo -n > $RESOLV_CONF | ||
| 123 | - [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF | ||
| 124 | - for i in $dns ; do | ||
| 125 | - echo adding dns $i | ||
| 126 | - echo nameserver $i >> $RESOLV_CONF | ||
| 127 | - done | ||
| 128 | - ;; | ||
| 129 | +*) echo "udhcpc: $*: unknown command" >&2 | ||
| 130 | + exit 1;; | ||
| 131 | esac | ||
| 132 | |||
| 133 | exit 0 | ||
