summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-03 10:31:52 +0200
committerErich Eckner <git@eckner.net>2018-09-03 10:31:52 +0200
commit7e1a38e5a342c2e25a2f2ab8e32ef326ce9c0b6e (patch)
tree1378101193e0b968a4f40532121293d0d1598051
parent620155ea8b1d3d4ec4d193fbc02421b1fca9730f (diff)
downloadbuilder-7e1a38e5a342c2e25a2f2ab8e32ef326ce9c0b6e.tar.xz
lib/load-configuration: check early for running mysqld, add a kill-switch /tmp/do-not-run-build-master
-rwxr-xr-xlib/load-configuration12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/load-configuration b/lib/load-configuration
index 9199281..a2ba0e0 100755
--- a/lib/load-configuration
+++ b/lib/load-configuration
@@ -4,9 +4,6 @@
# shellcheck disable=SC2034
-# TODO: a global kill-switch would be nice to block all activity before
-# a reboot
-
set -e
export LANG=C
@@ -33,6 +30,15 @@ fi
if [ "$(hostname)" = 'buildmaster.archlinux32.org' ]; then
i_am_the_master=true
+ # abort early if mysqld is not running or kill switch active
+ # ('/tmp/do-not-run-build-master')
+ if [ ! -S '/var/run/mysqld/mysqld.sock' ] || \
+ [ -f '/tmp/do-not-run-build-master' ]; then
+ >&2 echo 'mysqld is not running or build master is on halt'
+ >&2 echo 'I will abort - whatever you try to do would probably fail anyway.'
+ exit 1
+ fi
+
releng_directory="${work_dir}/repos/releng"
else
i_am_the_master=false