From 4f5570c2c07118f22bd9146b61514cae84e6700c Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Mon, 25 Jan 2016 21:29:05 +0100 Subject: reproducible fdroid: cleanup processes + workdir on failure --- bin/reproducible_setup_fdroid_build_environment.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bin/reproducible_setup_fdroid_build_environment.sh b/bin/reproducible_setup_fdroid_build_environment.sh index d4c8d146..67a64b82 100755 --- a/bin/reproducible_setup_fdroid_build_environment.sh +++ b/bin/reproducible_setup_fdroid_build_environment.sh @@ -17,6 +17,24 @@ common_init "$@" WORKSPACE=$BASE/fdroid mkdir -p $WORKSPACE +cleanup_all() { + echo "$(date -u) - cleanup in progress..." + killall VBoxHeadless || true + sleep 10 + rm $WORKSPACE -r + echo "$(date -u) - cleanup done." +} +trap cleanup_all INT TERM EXIT + +# TODO: +# +# +# add locking here to only run this if no build job is running… +# +# +# not yet needed, as we don't have any build jobs yet + + # make sure we have the vagrant box image cached test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver cd ~/.cache/fdroidserver @@ -33,3 +51,7 @@ cd $WORKSPACE git clone https://gitlab.com/fdroid/fdroidserver.git cd fdroidserver ./makebuildserver + +# remove trap +trap - INT TERM EXIT +echo "$(date -u) - the end." -- cgit v1.2.3-54-g00ecf