Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test-install: Wait for network in the lxc container.
Alex Vandivere0b725be63df
diff --git a/tools/test-install/lxc-wait b/tools/test-install/lxc-waitindex f836a2ff224..e395e5abaf7 100755--- a/tools/test-install/lxc-wait+++ b/tools/test-install/lxc-wait@@ -27,16 +27,36 @@ if [ "$EUID" -ne 0 ]; thenfi# We poll.-for _ in {1..60}; do- echo "lxc-wait: $CONTAINER_NAME: polling for boot..." >&2- runlevel="$(lxc-attach --clear-env -n "$CONTAINER_NAME" -- runlevel 2>/dev/null)" \- || { sleep 1; continue; }- if [ "$runlevel" != "${0%[0-9]}" ]; then- echo "lxc-wait: $CONTAINER_NAME: booted!" >&2+poll_runlevel() {+ for _ in {1..60}; do+ echo "lxc-wait: $CONTAINER_NAME: polling for boot..." >&2+ runlevel="$(lxc-attach --clear-env -n "$CONTAINER_NAME" -- runlevel 2>/dev/null)" \+ || { sleep 1; continue; }+ if [ "$runlevel" != "${0%[0-9]}" ]; then+ echo "lxc-wait: $CONTAINER_NAME: booted!" >&2+ poll_network+ fi+ sleep 1+ done+ echo "error: timeout waiting for container to boot" >&2+ exit 1+}+++poll_network() {+ for _ in {1..60}; do+ echo "lxc-wait: $CONTAINER_NAME: polling for network..." >&2+ # New hosts don't have `host` or `nslookup`+ lxc-attach --clear-env -n "$CONTAINER_NAME" -- \+ ping -q -c 1 archive.ubuntu.com 2>/dev/null >/dev/null \+ || { sleep 1; continue; }+ echo "lxc-wait: $CONTAINER_NAME: network is up!" >&2exit 0- fi- sleep 1-done+ done+ echo "error: timeout waiting for container to get network" >&2+ exit 1+}+++poll_runlevel-echo "error: timeout waiting for container to boot" >&2-exit 1