port wan_device changes from whiterussian to kamikaze
[openwrt.git] / package / base-files / default / sbin / ifup
1 #!/bin/sh
2 [ $# = 0 ] && { echo "  $0 <group>"; exit; }
3 . /etc/functions.sh
4 . /etc/network.overrides
5 [ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
6
7 ifdown $1
8
9 debug "### ifup $type ###"
10 type=$1
11
12 if_proto=$(nvram get ${type}_proto)
13 if=$(nvram get ${type}_ifname)
14
15 case "$if_proto" in
16         pppoa) hotplug_dev register atm0; exit 0 ;;
17         pppoe)
18                 ifconfig nas0 2>&- >&- || {
19                         hotplug_dev register atm0
20                         exit 0
21                 }
22         ;;
23         none|"") exit 0;;
24 esac
25
26 [ "${if%%[0-9]*}" = "ppp" ] && if="$(nvram get ${type}_device)"
27
28 if [ "${if%%[0-9]}" = "br" ]; then
29         for sif in $(nvram get ${type}_ifnames); do
30                 hotplug_dev register "$sif"
31         done
32 else
33         hotplug_dev register "$if"
34 fi