brcm47xx: fix network failsafe indication
[openwrt.git] / target / linux / brcm47xx / base-files / lib / preinit / 05_init_interfaces_brcm
1 #!/bin/sh
2
3 preinit_iface() {
4         ifname=eth0
5
6         # hardware specific overrides
7         case "$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)" in
8                 "Asus WLHDD") ifname=eth1;;
9                 "Asus WL300G") ifname=eth1;;
10         esac
11
12         local try=0;
13         while [ $((try++)) -le 5 ] && [ ! -f /sys/class/net/$ifname/operstate ]; do sleep 1; done
14 }
15
16 boot_hook_add preinit_main preinit_iface