On 12/30/05, Todd Walton <[EMAIL PROTECTED]> wrote:
> On 12/29/05, Carl Lowenstein <[EMAIL PROTECTED]> wrote:
> > Has anyone thought through the process of doing the equivalent of
> > RedHat/Fedora "mediacheck" but reading the CD from an already running
> > Linux system rather than booting into the installation RAMdisk system?
>
> The download page contains the SHA1 sums for the images:
> http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/iso/
>
> Maybe you could "dd if=/dev/cdrom | sha1sum".
That's not an answer to the question I asked. I know about checking
either MD5 or SHA1 sums for the downloaded image. I also know about
checking checksums against data read from the burned disc, and know
that there is a much faster way to do it. See below for a method that
is not computationally intensive, the secret ingredient is to compare
the image on the hard drive with the data read from the CD, byte by
byte. It runs at the speed of the CD reader. This routine also works
properly for DVD images, while the check routine built into k3b does
not.
- - - - - -
cat ~/bin/isocmp
#!/bin/bash
# -rwxrwxr-x 1 cdl cdl 747 Jul 22 21:42 /home/cdl/src/burncd/isocmp
# isocmp
# compare image on burned {cd,dvd} with its source file
# size=$(isosize -d 2048 $2)
# don't use isosize, in case the image is not really iso9660
case $# in
2) ;;
*) echo "usage: $0 /dev/cdrom /source/file.iso"; exit 2;;
esac
# a few sanity tests
if test ! -r $1
then echo "can't read $1"; exit 2
fi
if test ! -r $2
then echo "can't read $2"; exit 2
fi
if test ! -f $2
then echo "$2 is not a file"; exit 2
fi
# compute size of file in 2kB blocks
size=$( dc -e "$(ls -l $2 | gawk '{print $5}') 2048/p")
# do the real work here, compare device file and source file byte by byte
dd if=$1 bs=2k count=$size 2>/dev/null | cmp -s $2 -
# report result
case $? in
0) echo "good"; exit 0;;
*) echo "bad"; exit 1;;
esac
- - - - - -
The original question remains: using information placed on the CD by
RedHat/Fedora, can I perform the same "mediacheck" operation that they
do, without booting the disc.
Consider the "isocmp" routine to be a late Xmas present.
carl
--
carl lowenstein marine physical lab u.c. san diego
[EMAIL PROTECTED]
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list