#! /bin/sh # Author: http://en.opensuse.org/User:Mvidner set -o errexit USAGE=false IGNORE_GPG=false IGNORE_FILES=cat while getopts fgh FLAG; do case $FLAG in f) IGNORE_FILES=ignore_files;; g) IGNORE_GPG=true;; h) USAGE=true;; *) USAGE=true; RC=1;; esac done shift `expr $OPTIND - 1` if $USAGE; then cat < $STYLESHEET EOF # filter out nonexistent files from a sha1sum list ignore_files () { while read SUM FILE; do if [ -f $FILE ]; then echo "$SUM $FILE" else echo >&2 "$FILE: MISSING, IGNORED" fi done } repomd_verify () { test -f $1 || return case $1 in *.gz) CAT=zcat;; *) CAT=cat;; esac $CAT $1 | xsltproc $STYLESHEET - | $IGNORE_FILES | sha1sum -c - } if [ ! -d $DIR ]; then echo "Expecting $DIR in current directory" >&2 exit 1 fi repomd_verify "$DIR"/repomd.xml repomd_verify "$DIR"/patches.xml repomd_verify "$DIR"/primary.xml.gz echo "ALL OK"