summaryrefslogtreecommitdiffstats
path: root/core/modules/slx-network-configs-targets/data/opt/openslx/scripts/systemd-wait_online
blob: aaee9c321de18a37261360d6d7e98cc076d305f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/ash

# Wait until we have a nameserver in resolv.conf
# and we have a gateway configured

w=0
while ! grep -q ^nameserver /etc/resolv.conf && [ "$w" -lt 10 ]; do
	let w++
	sleep 1
done

# We don't consider a missing nameserver fatal, but a missing gateway, if no proxy is set
. /etc/profile
while [ -z "$http_proxy" ] && [ -z "$ALL_PROXY" ] && ! ip route show | grep -q ^default; do
	[ "$w" -gt 12 ] && exit 1 # Give up - not online
	let w++
	sleep 1
	. /etc/profile
done

exit 0