#!/bin/bash #------------------------------------------------------------------------ # md5scd ---- Data CD md5sum Verifier # Script to automate determining Md5sum for ISO9660 CD's # NOTE - This script assumes that correct md5sum is known and one wishes # to verify that a particular CD copy has been burnt correctly. # If working from a downloaded ISO image use "md5sum ISO" at command line #------------------------------------------------------------------------ # Requires standard tools found in all Linux Distributions # If script invoked as user, check all permissions, groups, etc. # Missing arguments? if [ $# -ne 2 ] then echo "Usage - md5scd mountpoint device, ex - md5scd /mnt/cdrom /dev/hdc" exit 1 else : OK have arguments fi # Loop over md5sum determination ...100 good copies for install-fest? again=yes while [ "$again" = yes ] do echo "Please insert CD at $1 and press ENTER when ready" read #Wait for insertion of disk mount $1 Block_Count=`df -k $1 | grep $1 | cut -c 25-30` #700Mb disk cannot exceed this ^^^^^ column limit in 1k blocks umount $1 Md5sum_Cd=`dd if=$2 count=$Block_Count bs=1024 | md5sum` echo "The md5sum of the CD at $1 is " $Md5sum_Cd echo echo -n "Verify another CD? [yes/no]" read again # Wait for yes -> repeat, anything else -> drop through' done exit 0