Clean containers

This commit is contained in:
Kay0u 2019-11-26 22:15:34 +09:00
parent 2f1c10f977
commit 16c66d76a1
No known key found for this signature in database
GPG key ID: 7FF262C033518333

View file

@ -10,9 +10,29 @@ set -eo pipefail
# trap any error, and mark it as a system failure. # trap any error, and mark it as a system failure.
trap "exit $SYSTEM_FAILURE_EXIT_CODE" ERR trap "exit $SYSTEM_FAILURE_EXIT_CODE" ERR
clean_containers()
{
for image_to_delete in "yunohost-$DEBIAN_VERSION yunohost-$DEBIAN_VERSION-tmp"
do
if lxc info $image_to_delete &>/dev/null
then
lxc delete $image_to_delete --force
fi
done
for image_to_delete in "yunohost-$DEBIAN_VERSION-before-install yunohost-$DEBIAN_VERSION-before-postinstall yunohost-$DEBIAN_VERSION-after-postinstall"
do
if lxc image info $image_to_delete &>/dev/null
then
lxc image delete $image_to_delete
fi
done
}
rebuild_base_container() rebuild_base_container()
{ {
lxc info "yunohost-$DEBIAN_VERSION" >/dev/null && lxc delete "yunohost-$DEBIAN_VERSION" --force clean_containers
lxc launch images:debian/$DEBIAN_VERSION/amd64 "yunohost-$DEBIAN_VERSION-tmp" lxc launch images:debian/$DEBIAN_VERSION/amd64 "yunohost-$DEBIAN_VERSION-tmp"
lxc exec "yunohost-$DEBIAN_VERSION-tmp" -- sh -c "apt-get install curl -y" lxc exec "yunohost-$DEBIAN_VERSION-tmp" -- sh -c "apt-get install curl -y"
# Install Git LFS, git comes pre installed with ubuntu image. # Install Git LFS, git comes pre installed with ubuntu image.