1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-04 00:17:06 +00:00

Prepare for multiple base system support and automatically update and remove stale vagrant boxes

This commit is contained in:
downtownallday 2021-09-14 08:20:37 -04:00
parent 3d32dbab22
commit 4b285c3201

View File

@ -3,23 +3,51 @@
vagrant destroy -f
rm -f prepcode.txt
vagrant up preloaded-ubuntu-bionic64
upcode=$?
prepcode=$(cat "./prepcode.txt")
rm -f prepcode.txt
echo ""
echo "VAGRANT UP RETURNED $upcode"
echo "PREPVM RETURNED $prepcode"
for plugin in "vagrant-vbguest" "vagrant-reload"
do
if ! vagrant plugin list | grep -F "$plugin" >/dev/null; then
vagrant plugin install "$plugin" || exit 1
fi
done
if [ "$prepcode" != "0" -o $upcode -ne 0 ]; then
echo "FAILED!!!!!!!!"
vagrant destroy -f
exit 1
fi
vagrant box update
vagrant halt
vagrant package
rm -f preloaded.box
mv package.box preloaded-ubuntu-bionic64.box
for box in "preloaded-ubuntu-bionic64"
do
vagrant up $box
upcode=$?
prepcode=$(cat "./prepcode.txt")
rm -f prepcode.txt
echo ""
echo "VAGRANT UP RETURNED $upcode"
echo "PREPVM RETURNED $prepcode"
vagrant destroy -f
if [ "$prepcode" != "0" -o $upcode -ne 0 ]; then
echo "FAILED!!!!!!!!"
vagrant destroy -f $box
exit 1
fi
if vagrant ssh $box -- cat /var/run/reboot-required; then
vagrant reload $box
fi
vagrant halt $box
vagrant package $box
rm -f $box.box
mv package.box $box.box
vagrant destroy -f $box
cached_name="$(sed 's/preloaded-/preloaded-miabldap-/' <<<"$box")"
echo "Removing cached box $cached_name"
if [ -e "../funcs.rb" ]; then
pushd .. > /dev/null
vagrant box remove $cached_name
code=$?
popd > /dev/null
else
vagrant box remove $cached_name
code=$?
fi
echo "Result: $code"
done