summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_setup_fdroid_build_environment.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2016-01-25 21:29:05 +0100
committerHolger Levsen <holger@layer-acht.org>2016-01-25 21:29:05 +0100
commit4f5570c2c07118f22bd9146b61514cae84e6700c (patch)
tree80fe0482ea8478dc93e590a161c11b41cf73033e /bin/reproducible_setup_fdroid_build_environment.sh
parent65dd084f70570c22953b4864cb662f4282c3fd1d (diff)
downloadjenkins.debian.net-4f5570c2c07118f22bd9146b61514cae84e6700c.tar.xz
reproducible fdroid: cleanup processes + workdir on failure
Diffstat (limited to 'bin/reproducible_setup_fdroid_build_environment.sh')
-rwxr-xr-xbin/reproducible_setup_fdroid_build_environment.sh22
1 files changed, 22 insertions, 0 deletions
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."