summaryrefslogtreecommitdiffstats
path: root/checkrepo
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-04-11 21:07:44 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-04-11 21:07:44 +0200
commit19d15666b8468f54b8837c2ce9cd4dcf5064991a (patch)
tree11273301b5e39a4b48704c3a85859af882470790 /checkrepo
parentb7a5f25717cd60d3ad76e7a1280ea6c1dd47835e (diff)
downloadrepo-tools-19d15666b8468f54b8837c2ce9cd4dcf5064991a.tar.gz
repo-tools-19d15666b8468f54b8837c2ce9cd4dcf5064991a.tar.xz
add a simple and slow integrity check
Diffstat (limited to 'checkrepo')
-rwxr-xr-xcheckrepo33
1 files changed, 33 insertions, 0 deletions
diff --git a/checkrepo b/checkrepo
new file mode 100755
index 0000000..ec8a5e7
--- /dev/null
+++ b/checkrepo
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+home="$(dirname "${0}")"
+target="${home}/repo"
+lock='/tmp/mirrorsync.lck'
+tmp="$(mktemp -d)"
+
+[ -f "${lock}" ] && exit 1
+touch "${lock}"
+
+grep_dbinfo() {
+ local _ret
+
+ _ret="$(grep -m 1 -A 1 "%$2%" "$1" | tail -1)"
+ echo -n "$_ret"
+}
+
+for repo in {core,extra,community,testing,community-testing}; do
+ for arch in {i686,x86_64}; do
+ echo "Reading $arch/$repo.db.tar.gz..."
+ mkdir -p $tmp/$repo/$arch
+ bsdtar xf $target/$repo/os/$arch/$repo.db.tar.gz -C $tmp/$repo/$arch
+ for p in $tmp/$repo/$arch/*/desc; do
+ echo "$(grep_dbinfo $p MD5SUM) $target/$repo/os/$arch/$(grep_dbinfo $p FILENAME)" >> $tmp/md5sums.txt
+ done
+ done
+done
+
+echo 'Checking repository...'
+md5sum -c --quiet $tmp/md5sums.txt
+
+rm -rf $tmp
+rm -f "${lock}"