Add controls over base image creation.
This commit is contained in:
parent
7e76d5ca43
commit
a44832c9ba
@ -25,11 +25,19 @@ if lxc list --format csv -q | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then
|
||||
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$BASE_IMAGE_VM_NAME"
|
||||
fi
|
||||
else
|
||||
# the base image is ubuntu:22.04.
|
||||
lxc init --profile="$BASE_IMAGE_VM_NAME" "$UBUNTU_BASE_IMAGE_NAME" "$BASE_IMAGE_VM_NAME" --vm --project=default
|
||||
|
||||
if ! lxc list --project default | grep -q "$BASE_IMAGE_VM_NAME"; then
|
||||
# the base image is ubuntu:22.04.
|
||||
lxc init -q --profile="$BASE_IMAGE_VM_NAME" "$UBUNTU_BASE_IMAGE_NAME" "$BASE_IMAGE_VM_NAME" --vm --project=default
|
||||
fi
|
||||
|
||||
|
||||
if lxc info "$BASE_IMAGE_VM_NAME" | grep -q "Status: STOPPED"; then
|
||||
# TODO move this sovereign-stack-base construction VM to separate dedicated IP
|
||||
lxc config set "$BASE_IMAGE_VM_NAME" --project=default
|
||||
lxc start "$BASE_IMAGE_VM_NAME" --project=default
|
||||
sleep 15
|
||||
fi
|
||||
|
||||
# for CHAIN in mainnet testnet; do
|
||||
# for DATA in blocks chainstate; do
|
||||
@ -37,9 +45,8 @@ else
|
||||
# done
|
||||
# done
|
||||
|
||||
lxc start "$BASE_IMAGE_VM_NAME" --project=default
|
||||
if lxc info "$BASE_IMAGE_VM_NAME" | grep -q "Status: RUNNING"; then
|
||||
|
||||
sleep 15
|
||||
while lxc exec "$BASE_IMAGE_VM_NAME" --project=default -- [ ! -f /var/lib/cloud/instance/boot-finished ]; do
|
||||
sleep 1
|
||||
done
|
||||
@ -71,6 +78,8 @@ else
|
||||
|
||||
# stop the VM and get a snapshot.
|
||||
lxc stop "$BASE_IMAGE_VM_NAME" --project=default
|
||||
fi
|
||||
|
||||
lxc snapshot "$BASE_IMAGE_VM_NAME" "$UBUNTU_BASE_IMAGE_NAME" --project=default
|
||||
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -exu
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
. ./base.sh
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 13df5bf172846f9a5c9c799695cef7b5fa299a91
|
||||
Subproject commit a8a6f7d289665cc20756ddf0e1ee1ead70668bd0
|
Loading…
Reference in New Issue
Block a user