[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Verifying packages



On Tue, 5 Feb 2002, Cameron Kerr wrote:

>My question is: Is it possible to verify all of the existing packages on
>the system so I can tell which packages have now corrupted files?

Hi, I couldn't find anything to do this, so I made something myself. The
md5sums for all package files are stored in
/var/lib/dpkg/info/$PACKAGE.md5sums, and you can run

md5sum -c /var/lib/dpkg/info/$PACKAGE.md5sums

to check the static files of a package (not those marked as a conf file, I
think). The fact that the md5sums are already stored by the dpkg suite
would indicate that there should already be a tool for doing this. Oh
well.

This script just rips though all the packages, and runs 'md5sum -c' on
them, reporting what packages are affected, and the error message. Fixing
individual errors is up to the user.

------ dpkg-verify -------
#!/bin/sh
# Quick script for verifying the integrity of package files on a Debian
# system.
# Cameron Kerr
# 6 February 2002
#
# NOTE: This is in no way an official Debian provided/supported program,
#       its just something I hacked up from need.
# $Id: dpkg-verify,v 0.0 2002/02/06 02:17:51 cameron Exp cameron $
# $Log: dpkg-verify,v $
# Revision 0.0  2002/02/06 02:17:51  cameron
# Initial Revision
#

/bin/ls /var/lib/dpkg/info/*.md5sums | \
        sed -e 's:^.*/\(..*\).md5sums$:\1:' | \
        while read package;
        do
                cd /
                md5sum -c /var/lib/dpkg/info/$package.md5sums 2>&1 | \
                        sed 's/\(.*\)/'"$package"':\1/'
        done
-------------------------

I'll probably stick this on my website one of these days.

PS. Can anyone tell me what is supposed to be in /var/lib/dpkg/available?
I had to remove it after the crash, as it was currupt, preventing me from
using dselect. It doesn't seem to grow at all after a apt-get update

Cameron Kerr
-- 
cameron.kerr@paradise.net.nz
http://homepages.paradise.net.nz/~cameronk/




Reply to: