index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-06-21 11:12:56 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-06-21 11:12:56 +0200 |
commit | ecceae922d481cc3dd4c1a1f8db7c38bdbc4743a (patch) | |
tree | e27f214da823782107d2694b3d05b2422ddb6435 /bin/sanity-check | |
parent | 2a84dd8adfed7fdff1c553908ecb353944000b63 (diff) |
-rwxr-xr-x | bin/sanity-check | 68 |
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 |