Re: OT: need script md5sum help

Todd and Margo Chester <[email protected]> Sun, 09 Dec 2007 19:29:19 -0800
Newsgroups gmane.comp.kde.k3b
Message-ID <[email protected]>
Todd and Margo Chester wrote:
> Hi All,
> 
>     Please forgive this somewhat off topic post.  I know
> that the intellectual knowledge exist here and I have
> had no luck elsewhere.
> 
>     I have a script that creates an ISO and then burns
> the iso to disk with cdrecord.  When I am finished, I
> take an MD5SUM of the original ISO and the raw cd in
> the drive.  They never match (I know the disk cut
> correctly too).
> 
>    Now, I know K3B does the same thing when cutting an ISO
> to disk.  What am I doing wrong?
> 
> Sum1=`md5sum MyNew.iso | awk '{print $1}'`
> Sum2=`md5sum /dev/scd0 | awk '{print $1}'`
> if [ "$Sum1" != "$Sum2" ]; then
>     echo "CRITICAL ERROR: Check sums do not match.  Bummer..."
> else
>     echo 'SUCCESS!'
> fi
> 
> 
> Many thanks,
> -T


Hi All,

FINALLY figured it out!  The trick is the "-eject" command in
cdrecord.  Without it, you NEVER get a good md5sum back from
the cd in the drive.

-T


# Write the new ISO file to disk
# Note: to get a good md5sum, cdrecord must eject the disk (-eject)
cdrecord -v gracetime=2 dev=$CD -dao \
     driveropts=burnfree -data -eject $NewIso

# inject the disk (close the door)
/usr/bin/eject -t /dev/scd0

echo "Verifying data"
Sum1=`md5sum $NewIso | awk '{print $1}'`
Sum2=`md5sum $CD     | awk '{print $1}'`

if [ "$Sum1" != "$Sum2" ]; then
    /usr/bin/aplay -q /usr/share/sounds/k3b_error1.wav &
    echo "CRITICAL ERROR: Check sums do not match.  Bummer..."
    echo "NewIso Sum <"$Sum1">"
    echo "NewCD  Sum <"$Sum2">"
else
    /usr/bin/aplay -q /usr/share/sounds/KDE_Dialog_Appear.wav &
    echo 'SUCCESS!'
fi





-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php