wok-tiny view busybox/stuff/udhcp.script @ rev 176

busybox: fix modules order
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 14 19:16:39 2021 +0000 (2021-07-14)
parents 2c3b4f47fbf5
children
line source
1 #!/bin/sh
3 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
5 [ "$subnet" = "255.255.255.255" ] && subnet="255.255.0.0" # qemu weirdness
6 RESOLV_CONF="/etc/resolv.conf"
7 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
8 [ -n "$subnet" ] && NETMASK="netmask $subnet"
10 case "$1" in
11 deconfig)
12 ifconfig $interface 0.0.0.0
13 for i in /etc/ipdown.d/*; do
14 [ -x $i ] && $i $interface
15 done ;;
17 renew|bound)
18 ifconfig $interface $ip $BROADCAST $NETMASK
20 if [ "$router" ] ; then
21 while route del default gw 0.0.0.0 dev $interface ; do
22 :
23 done
25 metric=0
26 for i in $router ; do
27 route add default gw $i dev $interface metric $((metric++))
28 done
29 fi
31 rm -f $RESOLV_CONF
32 [ "$domain" ] && echo search $domain >> $RESOLV_CONF
33 for i in $dns ; do
34 echo nameserver $i
35 done >> $RESOLV_CONF
36 [ "$1" = "bound" ] && for i in /etc/ipup.d/*; do
37 [ -x $i ] && $i $interface $ip $dns
38 done ;;
39 esac
41 exit 0