#!/bin/sh

preinit_iface() {
	ifname=eth0

	# hardware specific overrides
	case "$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)" in
		"Asus WLHDD") ifname=eth1;;
		"Asus WL300G") ifname=eth1;;
	esac

	local try=0;
	while [ $((try++)) -le 5 ] && [ ! -f /sys/class/net/$ifname/operstate ]; do sleep 1; done
}

boot_hook_add preinit_main preinit_iface
