From a4938cc0a9594028d117b970ce973155444ff565 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 3 Sep 2018 10:36:21 +0200 Subject: lib/load-configuration: check even earlier for kill switch --- lib/load-configuration | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/load-configuration b/lib/load-configuration index a2ba0e0..fc766a5 100755 --- a/lib/load-configuration +++ b/lib/load-configuration @@ -7,6 +7,21 @@ set -e export LANG=C +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 +else + i_am_the_master=false +fi + # dirty hack to get this stuff debugable from a bash if [ "x${0##*/}" = "x-bash" ] || [ "x${0##*/}" = "xbash" ] || [ "x${0##*/}" = "xdash" ]; then base_dir=$(pwd) @@ -27,22 +42,9 @@ if pgrep -x mysqld >/dev/null 2>&1; then . "${base_dir}/lib/mysql-functions" 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 - +if ${i_am_the_master}; then releng_directory="${work_dir}/repos/releng" else - i_am_the_master=false - repo_names='packages community archlinux32' repo_paths__packages="${work_dir}/repos/packages" repo_paths__community="${work_dir}/repos/community" -- cgit v1.2.3