diff options
author | Erich Eckner <git@eckner.net> | 2018-09-03 10:36:21 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-03 10:36:21 +0200 |
commit | a4938cc0a9594028d117b970ce973155444ff565 (patch) | |
tree | 72d29b01d574c6643176bbe64fc22ca5344e0bc8 | |
parent | 7e1a38e5a342c2e25a2f2ab8e32ef326ce9c0b6e (diff) | |
download | builder-a4938cc0a9594028d117b970ce973155444ff565.tar.xz |
lib/load-configuration: check even earlier for kill switch
-rwxr-xr-x | lib/load-configuration | 30 |
1 files 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" |