Dash:
[t2.git] / package / network / udhcp / t2-default.script
blob00119de7ff0a82fd0ffe4d46fe69176220053660
1 #!/bin/sh
3 case "$1" in
4 deconfig)
5 ip link set $interface up
6 ip addr flush dev $interface
7 ;;
8 bound)
9 netmask=`ipnm2nwbc -v $ip $subnet | grep "^Network" | cut -d'/' -f2 | tr -d ' '`
10 ip addr add $ip/$netmask dev $interface
11 for x in $router; do
12 ip route add default via $x dev $interface
13 done
14 if [ "$UPDATE_RESOLVCONF" != 0 ]; then
15 touch /etc/resolv.conf
16 if [ "$domain" ]; then
17 grep -v "^domain" /etc/resolv.conf > /tmp/resolv.conf.$$
18 echo "domain $domain" >> /tmp/resolv.conf.$$
19 cat /tmp/resolv.conf.$$ > /etc/resolv.conf
21 if [ "$dns" ]; then
22 grep -v "^nameserver" /etc/resolv.conf > /tmp/resolv.conf.$$
23 for x in $dns; do
24 echo "nameserver $x" >> /tmp/resolv.conf.$$
25 done
26 cat /tmp/resolv.conf.$$ > /etc/resolv.conf
28 rm -f /tmp/resolv.conf.$$
32 echo "Unknown method $1"
33 exit 2 ;;
34 esac