summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-07-27 19:47:03 +0200
committerKarel Kočí <cynerd@email.cz>2020-07-27 19:47:03 +0200
commit2f64edb7fa0d9f584f168f4d3532d5bf4d0fcdd1 (patch)
tree6de34a3e8d5d1e40b1881f83536afefe3c4eb7f0
parentbcab686cae0caa6698ac9094f7d9020c387e33bf (diff)
downloadlaminar-cnf-2f64edb7fa0d9f584f168f4d3532d5bf4d0fcdd1.tar.gz
laminar-cnf-2f64edb7fa0d9f584f168f4d3532d5bf4d0fcdd1.tar.bz2
laminar-cnf-2f64edb7fa0d9f584f168f4d3532d5bf4d0fcdd1.zip
turris: run only one job type instance
-rwxr-xr-xtemplates/turris.run7
1 files changed, 6 insertions, 1 deletions
diff --git a/templates/turris.run b/templates/turris.run
index 9c2bc0c..0752be4 100755
--- a/templates/turris.run
+++ b/templates/turris.run
@@ -7,7 +7,12 @@ num_jobs="$(($(nproc) * 2))"
make="force-make -j$num_jobs -d$num_jobs -f V=99 -- -l$(nproc) BUILD_LOG=1"
###################################################
export IS_TTY=1
-# TODO take lock so we won't run multiple instances of new builds
+
+# Lock for execution
+if [ "$1" != "--locked" ]; then
+ exec flock --exclusive "$WORKSPACE/execution.lock" "$0" --locked "$@"
+fi
+shift # Shift --locked
curl "https://repo.turris.cz/$ANIMAL/$BOARD/packages/git-hash" > git-hash
cat git-hash