wok-current annotate busybox/stuff/udhcp.script @ rev 10595

samba: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 26 12:47:25 2011 +0200 (2011-05-26)
parents bc79e85a1561
children 127ec27f61ab
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@5776 7 [ "$subnet" == "255.255.255.255" ] && subnet="255.255.0.0" # qemu weirdness
pascal@1770 8 RESOLV_CONF="/etc/resolv.conf"
pascal@1770 9 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
pascal@1770 10 [ -n "$subnet" ] && NETMASK="netmask $subnet"
pascal@1770 11
pascal@1770 12 case "$1" in
pascal@1770 13 deconfig)
pascal@1770 14 /sbin/ifconfig $interface 0.0.0.0
pascal@1770 15 for i in /etc/ipdown.d/*; do
pascal@4544 16 [ -x $i ] && $i $interface
pascal@1770 17 done
pascal@1770 18 ;;
pascal@1770 19
pascal@1770 20 renew|bound)
pascal@1770 21 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
pascal@1770 22
pascal@1770 23 if [ -n "$router" ] ; then
pascal@1770 24 echo "deleting routers"
pascal@1770 25 while route del default gw 0.0.0.0 dev $interface ; do
pascal@1770 26 :
pascal@1770 27 done
pascal@1770 28
pascal@1770 29 metric=0
pascal@1770 30 for i in $router ; do
pascal@1770 31 route add default gw $i dev $interface metric $((metric++))
pascal@1770 32 done
pascal@1770 33 fi
pascal@1770 34
pascal@1770 35 echo -n > $RESOLV_CONF
pascal@1770 36 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
pascal@1770 37 for i in $dns ; do
pascal@1770 38 echo adding dns $i
pascal@1770 39 echo nameserver $i >> $RESOLV_CONF
pascal@1770 40 done
pascal@4544 41 [ "$1" == "bound" ] && for i in /etc/ipup.d/*; do
pascal@4544 42 [ -x $i ] && $i $interface $ip $dns
pascal@1770 43 done
pascal@1770 44 ;;
pascal@1770 45 esac
pascal@1770 46
pascal@1770 47 exit 0