From 423d088191e509adb7164c4dc48aac764fe158b5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 24 May 2019 14:26:38 +0200 Subject: bin/sanity-check: add check for reachability of master mirror --- bin/sanity-check | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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 ] || \ -- cgit v1.2.3-54-g00ecf