1
1

Improve control flow.

This commit is contained in:
Derek Smith 2023-03-19 16:42:48 -04:00
parent 5dc7194a62
commit 786d34df93
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
2 changed files with 8 additions and 5 deletions

View File

@ -120,17 +120,15 @@ if ! lxc list --format csv | grep -q ss-mgmt; then
if [ -d "$BITCOIN_MAINNET_BLOCKS_PATH" ]; then if [ -d "$BITCOIN_MAINNET_BLOCKS_PATH" ]; then
lxc config device add ss-mgmt ss-mainnet-blocks disk source="$BITCOIN_MAINNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/blocks lxc config device add ss-mgmt ss-mainnet-blocks disk source="$BITCOIN_MAINNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/blocks
else else
echo "WARNING: the blocks directory was not found for mainnet. It will NOT be mounted into ss-mgmt." echo "INFO: the blocks directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
exit 1
fi fi
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in. # if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
BITCOIN_MAINNET_CHAINSTATE_PATH="$BITCOIN_DIR/chainstate" BITCOIN_MAINNET_CHAINSTATE_PATH="$BITCOIN_DIR/chainstate"
if [ -d "$BITCOIN_MAINNET_CHAINSTATE_PATH" ]; then if [ -d "$BITCOIN_MAINNET_CHAINSTATE_PATH" ]; then
lxc config device add ss-mgmt ss-mainnet-chainstate disk source="$BITCOIN_MAINNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/chainstate lxc config device add ss-mgmt ss-mainnet-chainstate disk source="$BITCOIN_MAINNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/chainstate
else else
echo "WARNING: the chainstate directory was not found for mainnet. It will NOT be mounted into ss-mgmt." echo "INFO: the chainstate directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
exit 1
fi fi
# mount the ssh directory in there. # mount the ssh directory in there.

View File

@ -7,6 +7,11 @@ if ! lxc remote get-default | grep -q "local"; then
lxc remote switch "local" lxc remote switch "local"
fi fi
if ! lxc list -q --format csv | grep -q ss-mgmt; then
echo "ERROR: the 'ss-mgmt' VM does not exist. You may need to run install.sh"
exit 1
fi
# if the mgmt machine doesn't exist, then warn the user to perform ./install.sh # if the mgmt machine doesn't exist, then warn the user to perform ./install.sh
if ! lxc list --format csv | grep -q "ss-mgmt"; then if ! lxc list --format csv | grep -q "ss-mgmt"; then
echo "ERROR: the management machine VM does not exist. You probably need to run './install.sh'." echo "ERROR: the management machine VM does not exist. You probably need to run './install.sh'."