1
1
sovereign-stack/management/wait_for_ip.sh

33 lines
672 B
Bash
Raw Normal View History

2023-02-01 19:44:05 +00:00
#!/bin/bash
set -e
IP_V4_ADDRESS=
while true; do
# wait for
2023-09-22 23:46:07 +00:00
if incus list ss-mgmt | grep -q enp5s0; then
2023-02-01 19:44:05 +00:00
break;
else
sleep 1
fi
done
while true; do
2023-09-22 23:46:07 +00:00
IP_V4_ADDRESS=$(incus list ss-mgmt --format csv --columns=4 | grep enp5s0 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
2023-02-01 19:44:05 +00:00
if [ -n "$IP_V4_ADDRESS" ]; then
# give the machine extra time to spin up.
break;
else
sleep 1
printf '.'
fi
done
export IP_V4_ADDRESS="$IP_V4_ADDRESS"
2023-04-12 14:03:46 +00:00
# wait for the VM to complete its default cloud-init.
2023-09-22 23:46:07 +00:00
while incus exec ss-mgmt -- [ ! -f /var/lib/cloud/instance/boot-finished ]; do
2023-04-12 14:03:46 +00:00
sleep 1
done