#!/bin/sh
LOG=/var/log/chkrpm.log
tf=/tmp/rpm.lst.$$

fatal() {
   echo "FATAL ERROR: $*"
   rm -f $tf
   exit 1
}

rm -f $tf
rpm -qa | sort > $tf || fatal 'rpm query all'
xargs -a $tf -n 1 --verbose rpm -V 2>&1 | tee $LOG
rm -f $tf
echo "Done. Logfile is $LOG"