]> rtime.felk.cvut.cz Git - can-eth-gw.git/blob - distro/customroot/etc/udhcpc.default
benchmarking and debugging distributions added; benchmark script added
[can-eth-gw.git] / distro / customroot / etc / udhcpc.default
1 #!/bin/sh
2
3 PATH=/bin:/usr/bin:/sbin:/usr/sbin
4
5 RESOLV_CONF="/etc/resolv.conf"
6
7 update_interface()
8 {
9   [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
10   [ -n "$subnet" ] && NETMASK="netmask $subnet"
11   /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
12 }
13
14 update_routes()
15 {
16   if [ -n "$router" ]
17   then
18     echo "deleting routes"
19     while /sbin/route del default gw 0.0.0.0 dev $interface
20     do :
21     done
22
23     for i in $router
24     do
25       /sbin/route add default gw $i dev $interface
26     done
27   fi
28 }
29
30 update_dns()
31 {
32   echo -n > $RESOLV_CONF
33   [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
34   for i in $dns
35   do
36     echo adding dns $i
37     echo nameserver $i >> $RESOLV_CONF
38   done
39 }
40
41 deconfig()
42 {
43   /sbin/ifconfig $interface 0.0.0.0
44 }
45
46 case "$1" in
47   bound)
48     update_interface;
49     update_routes;
50     update_dns;
51   ;;
52
53   renew)
54     update_interface;
55     update_routes;
56     update_dns;
57   ;;
58
59   deconfig)
60     deconfig;
61   ;;
62
63   *)
64     echo "Usage: $0 {bound|renew|deconfig}"
65     exit 1
66     ;;
67 esac
68
69 exit 0