move brcm-specific hotplug net scripts into the right place
[openwrt/svn-archive/archive.git] / openwrt / target / linux / package / base-files / files / brcm-2.4 / etc / hotplug.d / net / 09-net
1 #!/bin/sh
2 setup_eth()
3 {
4 for part in $(nvram get unused_ifnames); do
5 [ "$part" = "$INTERFACE" ] && exit 0
6 done
7 [ -f /proc/net/wl0 ] && {
8 lsmod | grep wlcompat >&- || insmod wlcompat
9 }
10 iwconfig "$INTERFACE" 2>&- | grep -v 'no wireless' >&- && {
11 /sbin/wifi
12 }
13 [ -d /proc/switch ] || {
14 insmod switch-core
15 insmod switch-robo || insmod switch-adm
16 }
17 if="$(echo "$INTERFACE" | sed s,eth,et,)"
18 ifconfig "$INTERFACE" up 2>&- >&-
19 [ -d "/proc/switch/$INTERFACE" ] || return 0
20 echo "1" > "/proc/switch/$INTERFACE/enable_vlan"
21 for vlan in $(seq 0 15); do
22 [ "$(nvram get vlan${vlan}hwname)" = "$if" ] && {
23 vports="$(nvram get vlan${vlan}ports)"
24 [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports"
25 $DEBUG vconfig add "$INTERFACE" "$vlan"
26 }
27 done
28 }
29
30 do_register()
31 {
32 case "${INTERFACE%%[0-9]*}" in
33 eth) setup_eth;;
34 esac
35 }
36
37
38 case "$ACTION" in
39 add|register) do_register;;
40 esac