diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-11-23 19:10:59 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-11-23 19:10:59 +0100 |
commit | 3f232a376754faff6413e2ec22a9e89d06121763 (patch) | |
tree | a1467db39ee2ec2c19e3b9673c5a0b8d576dda50 | |
parent | 2b25805e7b1e570cd31cd94d0f4a4d075d4a22a2 (diff) | |
download | builder-3f232a376754faff6413e2ec22a9e89d06121763.tar.xz |
better way of stopping build-package in systemd service
-rwxr-xr-x | bin/build-packages | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/build-packages b/bin/build-packages index be6bf16..e33faaa 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -65,6 +65,8 @@ usage() { >&2 echo ' Cannot be combined with -l.' >&2 echo ' -x: If package build fails, do not request new assignment(s).' >&2 echo ' Cannot be combined with -l.' + >&2 echo ' -S|--stop:' + >&2 echo ' Stop the slave gracefully (touching the stop switch file).' >&2 echo '' >&2 echo 'known straws (separated by and enclosed in ":", sets of straws separated by " "):' >&2 echo ' :clean_chroot:' @@ -87,13 +89,14 @@ usage() { } eval set -- "$( - getopt -o d:hl:n:p:s:t:ux \ + getopt -o d:hl:n:p:s:t:uxS \ --long diff: \ --long help \ --long local: \ --long prefer: \ --long straw: \ --long upload \ + --long stop \ -n "$(basename "$0")" -- "$@" || \ echo usage )" @@ -104,6 +107,7 @@ unset forced_package unset forced_straws unset prefered_package exit_after_failure=false +stop_slave=false timeout=0 while true @@ -146,6 +150,9 @@ do shift forced_straws="${forced_straws} $1" ;; + -S|--stop) + stop_slave=true + ;; -t) shift timeout="$1" @@ -170,6 +177,12 @@ if [ $# -ne 0 ]; then usage fi +if ${stop_slave}; then + SLAVE=$(whoami) + touch "/tmp/do-not-run-build-slave.$SLAVE" + exit 0 +fi + if [ -n "${diff_source_dir}" ]; then if [ -n "${count}" ] || \ [ -n "${forced_package}" ] || \ |