aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL/wait_for_net.sh
blob: b16e09128a499311b1aa8e9e2031cbaf3dc5277b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

### this script is used as entrypoint of the docker container to wait for network to be up ###

IFACE="veth0 eth0"

function wait_net() {
	for i in $IFACE; do
		[[ "$(cat /sys/class/net/$i/operstate 2>/dev/null)" == "up" ]] && return 1
		ip link set mtu 1300 dev $IFACE
	done
	return 0
}

while wait_net; do
	sleep 1
done

[[ $# > 0 ]] && exec "$@"
exec /bin/bash -l