From ecceae922d481cc3dd4c1a1f8db7c38bdbc4743a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 21 Jun 2017 11:12:56 +0200 Subject: bin/sanity-check: new, so far very few tests --- bin/sanity-check | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 bin/sanity-check (limited to 'bin/sanity-check') diff --git a/bin/sanity-check b/bin/sanity-check new file mode 100755 index 0000000..631143f --- /dev/null +++ b/bin/sanity-check @@ -0,0 +1,68 @@ +#!/bin/sh + +# do some basic sanity checks + +. "${0%/*}/../conf/default.conf" + +while [ $# -gt 0 ]; do + + case "$1" in + + mirror) + + >&2 echo 'sanity-check: checking mirror ...' + + repos='community-staging community-testing community core extra gnome-unstable kde-unstable staging testing' + + errors="$( + ( + printf '%s\n' ${repos} + ls_master_mirror 'i686' + ) | \ + sort | \ + uniq -u + )" + if [ -n "${errors}" ]; then + echo "The following repos are missing or obsolete on the mirror:" + echo "${errors}" + exit 1 + fi + + for repo in ${repos}; do + + packages="$( + ls_master_mirror "i686/${repo}" | \ + grep '\.pkg\.tar\.xz\(\.sig\)\?$' + )" + + errors="$( + echo "${packages}" | \ + sed 's|\.sig$||' | \ + uniq -c | \ + grep -v '^\s*2\s' | \ + awk '{print $2}' + )" + if [ -n "${errors}" ]; then + echo "The following packages in ${repo} are missing a signature or vice versa:" + echo "${errors}" + exit 1 + fi + + done + + >&2 echo '... passed.' + + ;; + + *) + + >&2 printf 'sanity-check: unknown check "%s".' "$1" + exit 2 + + ;; + + esac + + shift + +done -- cgit v1.2.3-54-g00ecf