summaryrefslogtreecommitdiff
path: root/bin/sanity-check
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-24 14:26:38 +0200
committerErich Eckner <git@eckner.net>2019-05-24 14:26:38 +0200
commit423d088191e509adb7164c4dc48aac764fe158b5 (patch)
tree334d175bfcb6f830c84a186b0540e3745b2f76a1 /bin/sanity-check
parent2b0f8d0f534040e85c1c51b9bf0cf6d635d43714 (diff)
downloadbuilder-423d088191e509adb7164c4dc48aac764fe158b5.tar.xz
bin/sanity-check: add check for reachability of master mirror
Diffstat (limited to 'bin/sanity-check')
-rwxr-xr-xbin/sanity-check29
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 ] || \