diff options
author | Erich Eckner <git@eckner.net> | 2019-05-24 14:26:38 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-05-24 14:26:38 +0200 |
commit | 423d088191e509adb7164c4dc48aac764fe158b5 (patch) | |
tree | 334d175bfcb6f830c84a186b0540e3745b2f76a1 | |
parent | 2b0f8d0f534040e85c1c51b9bf0cf6d635d43714 (diff) | |
download | builder-423d088191e509adb7164c4dc48aac764fe158b5.tar.xz |
bin/sanity-check: add check for reachability of master mirror
-rwxr-xr-x | bin/sanity-check | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/bin/sanity-check b/bin/sanity-check index df0b43c..df273fa 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -128,13 +128,40 @@ touch "${tmp_dir}/messages" trap 'finish' EXIT if [ $# -eq 0 ]; then - set -- git-repositories build-list mysql repos package-database track-state + set -- git-repositories build-list mysql master-mirror-availability repos package-database track-state fi while [ $# -gt 0 ]; do case "$1" in + master-mirror-availability) + + for host in $( + printf '%s\n' \ + "${master_mirror_sftp_command}" \ + "${master_mirror_rsync_directory}" | \ + sed ' + s,^.*@\([^:/@]\+\)\([:/].*\)\?$,\1, + t + d + ' | \ + sort -u + ); do + if ! ping -c1 "${host}" >/dev/null 2>&1; then + if [ ${silence} -le 1 ]; then + printf '\nThe master mirror %s cannot be reached.\n' \ + "${host}" | \ + tee -a "${tmp_dir}/messages" >&2 + fi + i_am_insane + # if the master mirror cannot be reached, further tests do not make any sense + set -- + fi + done + + ;; + git-repositories) [ ${silence} -gt 0 ] || \ |