summaryrefslogtreecommitdiffstats
path: root/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
blob: f2a53783ec208ae304084a5fe8990d542cd7a0f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/ash

source /run/network.conf

for i in 1 2 3 4 5 6 7 8; do
	echo "<$i> Try to fix broken network"
	echo -n "Take interface $IFACE down .. "

	ip link set dev "$IFACE" down
	usleep 10000

	echo "and up again.."
	ip link set dev "$IFACE" up
	ip link set dev "$BRIDGE" up
	usleep 100000

	wait_for_iface "$IFACE" 20

	udhcpc $PARAM -O ntpsrv -O domain -O search -t 6 -T 4 -A 5 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"

	if [ $? -eq 0 ]; then
		echo "Finally fixed IP config. Continue boot."
		RET=0
		break
	else
		RET=1
	fi
done

[ $RET -gt 0 ] && drop_shell "Something is really broken.. Please check your network cable and reset your computer."

# create correct return value
[ $RET -eq 0 ]