From 13d8e867a2efdcacd9ffa9a9f4dd3a9f4a9788eb Mon Sep 17 00:00:00 2001 From: downtownallday Date: Mon, 27 Jun 2022 14:28:59 -0400 Subject: [PATCH] Add color to the output --- tests/vagrant/majorupgrade/majorupgrade.sh | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/vagrant/majorupgrade/majorupgrade.sh b/tests/vagrant/majorupgrade/majorupgrade.sh index fbcbdf8b..b7ecc9a5 100755 --- a/tests/vagrant/majorupgrade/majorupgrade.sh +++ b/tests/vagrant/majorupgrade/majorupgrade.sh @@ -3,6 +3,9 @@ # run from this script's directory cd $(dirname "$0") +source ../../lib/color-output.sh + +warn "Destroy existing VMs" vagrant destroy -f artifact_dir_local="$(dirname "$0")/../../out/majorupgrade" @@ -10,24 +13,40 @@ artifact_dir_vm="/mailinabox/tests/out/majorupgrade" oldvm="major-upgrade-oldvm" newvm="major-upgrade-newvm" -# bring up oldvm, install, populate, and backup -# installed source code is in $HOME/miabldap-bionic (see Vagrantfile). $HOME is /root +# +# bring up oldvm +# ... then install, populate, and backup +# ... installed source is in $HOME/miabldap-bionic ($HOME is /root) +# + +warn "Bring up $oldvm" vagrant up $oldvm || exit 1 + +warn "Run managment/backup.py" vagrant ssh $oldvm -- "sudo -H bash -c 'cd \$HOME/miabldap-bionic; management/backup.py' && echo 'backup successful'" || exit 2 # copy artifacts from oldvm to host +warn "Copy artifacts" rm -rf "$artifact_dir_local" mkdir -p "$artifact_dir_local" vagrant ssh $oldvm -- "cd \"$artifact_dir_vm\" || exit 1; sudo -H cp -R /tmp/state/oldvm state || exit 2; sudo -H cp -R /home/user-data/backup backup || exit 3" || exit $? # destroy oldvm - bring up newvm +warn "Destroy $oldvm - no longer needed" vagrant destroy $oldvm -f + +# +# bring up newvm +# + +warn "Bring up $newvm" + +# inputs to Vagrantfile passed through environment export storage_user="user-data" export duplicity_files="$artifact_dir_vm/backup/encrypted" export secret_key="$artifact_dir_vm/backup/secret_key.txt" export restore_to="/home/user-data" - vagrant up $newvm || exit 1 # compare states @@ -36,4 +55,4 @@ vagrant ssh $newvm -- "cd /mailinabox; sudo -H bash -c 'source tests/lib/all.sh; # run tests vagrant ssh $newvm -- "cd /mailinabox; sudo -H tests/runner.sh upgrade-basic upgrade-totpuser default" || exit 3 -echo 'Success' +success 'Success'