summaryrefslogtreecommitdiff
path: root/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm
blob: f40e160b3b03f587fbda4b50676961d01af24284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

preinit_ip() {
	# if the preinit interface isn't specified and ifname is set in
	# preinit.arch use that interface
	if [ -z "$pi_ifname" ]; then
		pi_ifname=$ifname
	fi

	[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
		ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up

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