Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/sanity-check
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-21 11:12:56 +0200
committerErich Eckner <git@eckner.net>2017-06-21 11:12:56 +0200
commitecceae922d481cc3dd4c1a1f8db7c38bdbc4743a (patch)
treee27f214da823782107d2694b3d05b2422ddb6435 /bin/sanity-check
parent2a84dd8adfed7fdff1c553908ecb353944000b63 (diff)
bin/sanity-check: new, so far very few tests
Diffstat (limited to 'bin/sanity-check')
-rwxr-xr-xbin/sanity-check68
1 files changed, 68 insertions, 0 deletions
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