wok-4.x annotate busybox/stuff/udhcp.script @ rev 2474
lua, lx*, lzlib: update depends
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 15 20:05:38 2009 +0000 (2009-03-15) |
parents | |
children | bc79e85a1561 |
rev | line source |
---|---|
pascal@1770 | 1 #!/bin/sh |
pascal@1770 | 2 |
pascal@1770 | 3 # udhcpc script edited by Tim Riker <Tim@Rikers.org> |
pascal@1770 | 4 |
pascal@1770 | 5 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 |
pascal@1770 | 6 |
pascal@1770 | 7 RESOLV_CONF="/etc/resolv.conf" |
pascal@1770 | 8 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" |
pascal@1770 | 9 [ -n "$subnet" ] && NETMASK="netmask $subnet" |
pascal@1770 | 10 |
pascal@1770 | 11 case "$1" in |
pascal@1770 | 12 deconfig) |
pascal@1770 | 13 /sbin/ifconfig $interface 0.0.0.0 |
pascal@1770 | 14 for i in /etc/ipdown.d/*; do |
pascal@1770 | 15 [ -e $i ] && . $i $interface |
pascal@1770 | 16 done |
pascal@1770 | 17 ;; |
pascal@1770 | 18 |
pascal@1770 | 19 renew|bound) |
pascal@1770 | 20 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK |
pascal@1770 | 21 |
pascal@1770 | 22 if [ -n "$router" ] ; then |
pascal@1770 | 23 echo "deleting routers" |
pascal@1770 | 24 while route del default gw 0.0.0.0 dev $interface ; do |
pascal@1770 | 25 : |
pascal@1770 | 26 done |
pascal@1770 | 27 |
pascal@1770 | 28 metric=0 |
pascal@1770 | 29 for i in $router ; do |
pascal@1770 | 30 route add default gw $i dev $interface metric $((metric++)) |
pascal@1770 | 31 done |
pascal@1770 | 32 fi |
pascal@1770 | 33 |
pascal@1770 | 34 echo -n > $RESOLV_CONF |
pascal@1770 | 35 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF |
pascal@1770 | 36 for i in $dns ; do |
pascal@1770 | 37 echo adding dns $i |
pascal@1770 | 38 echo nameserver $i >> $RESOLV_CONF |
pascal@1770 | 39 done |
pascal@1770 | 40 for i in /etc/ipup.d/*; do |
pascal@1770 | 41 [ -e $i ] && . $i $interface $ip $dns |
pascal@1770 | 42 done |
pascal@1770 | 43 ;; |
pascal@1770 | 44 esac |
pascal@1770 | 45 |
pascal@1770 | 46 exit 0 |