On 09/30/03 Anatoly Vorobey wrote: > I apologise if this is a silly question, or a question > answered in some standard place I didn't think of checking. > > Is there any easy way to scan my entire tree of files, starting > with /, and to report all files which either do not match their > checksum stored in the package database, or aren't registered > in the package database? Obviously there should also be some > easy way of excluding whole directories such as /home, /etc > or /var.
Shouldn't be hard using qpkg, epm or etcat, but it will take some time.
Untested code:
for p in `qpkg -I -v -nc`; do
for f in `qpkg -l -nc $p`; do
if [ -f "$f" ]; then
CURRENT_MD5=`md5sum $f | cut -d' ' -f 1`
RECORD_MD5=`grep $f /var/db/pkg/$p/CONTENTS|cut -d' ' -f 3`
[ "$CURRENT_MD5" == "$RECORD_MD5" ] \
|| echo "$f ( $p )" >> /tmp/md5fail.list \
&& echo "$f ( $p )" >> /tmp/checkok.list
fi
done
done
After that compare /tmp/checkok.list with the result from
find / -type f
to find files that are unregistered/have a bad md5/are missing on the
system. That code is completely untested and doesn't do any error
checking, so use it at your own risk. If it works it will also take some
time, depending how many packages and how many files you've installed.
Marius
--
Public Key at http://www.genone.de/info/gpg-key.pub
In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.
pgp00000.pgp
Description: PGP signature
