summaryrefslogtreecommitdiff
path: root/templates/turris.run
diff options
context:
space:
mode:
Diffstat (limited to 'templates/turris.run')
-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