#!/bin/bash
# checks filesystem against dpkg's md5sums 
#
# Author: Filippo Giunchedi <filippo@esaurito.net>
# Version: 0.1
#
# this file is public domain 

exclude="usr/share/locale/"
include="bin/"

pushd .
cd /

for f in /var/lib/dpkg/info/*.md5sums; do
    package=$( basename "$f" | cut -d. -f1 )
    tmpfile=$( mktemp /tmp/dpkgcheck.XXXXXX )
    egrep "$include" "$f" | egrep -v "$exclude" > $tmpfile
    if [ -z "$(head $tmpfile)" ]; then continue; fi
    md5sum -c "$tmpfile"
    if [ $? -gt 0 ]; then
        echo "md5sum for $package has failed!"
        rm "$tmpfile"
        break
    fi
    rm "$tmpfile"
done

popd

Generated with vim2html
Copyright © 2003-2004 by Chip Cuccio <http://norlug.org/~chipster/finger>