tools/imagesums: use newer features in latest mkisofs/genisoimage to grab

pre-calculated MD5 and SHA1 checksums directly from the jigdo file
This commit is contained in:
Steve McIntyre 2008-07-18 12:23:28 +00:00
parent 73f31c1b5a
commit bcdd6107b9
1 changed files with 26 additions and 15 deletions

View File

@ -3,26 +3,42 @@
cd $1 cd $1
:> MD5SUMS :> MD5SUMS
:> SHA1SUMS
case $DOJIGDO in case $DOJIGDO in
0) 0)
for file in `find * -name \*.iso` for file in `find * -name \*.iso`
do do
md5sum $file >> MD5SUMS md5sum $file >> MD5SUMS
sha1sum $file >> SHA1SUMS
done done
;; ;;
1|2) 1|2)
for file in `find * -name \*.template` for file in `find * -name \*.jigdo`
do do
if [ "`tail --bytes=33 "$file" | head --bytes=1 | od -tx1 -An | sed -e 's/ //g'`" != 05 ]; then iso=${file%%.jigdo}.iso
echo "Possibly invalid template $file"
exit grep -q $iso MD5SUMS
fi if [ $? -ne 0 ] ; then
grep -q " ${file%%.template}.iso"'$$' MD5SUMS \ MD5=`zcat -f $file | awk '/Image Hex MD5Sum/ {print $5}'`
|| echo "`tail --bytes=26 "$file" | \ if [ "$MD5"x != ""x ] ; then
head --bytes=16 | \ echo "$MD5 $iso" >> MD5SUMS
od -tx1 -An | \ else
sed -e 's/ //g'` ${file%%.template}.iso" >> MD5SUMS echo "Jigdo file does not contain the Image MD5, calculating by hand"
md5sum $iso >> MD5SUMS
fi
fi
grep -q $iso SHA1SUMS
if [ $? -ne 0 ] ; then
SHA1=`zcat -f $file | awk '/Image Hex SHA1Sum/ {print $5}'`
if [ "$SHA1"x != ""x ] ; then
echo "$SHA1 $iso" >> SHA1SUMS
else
echo "Jigdo file does not contain the Image SHA1, calculating by hand"
sha1sum $iso >> SHA1SUMS
fi
fi
done done
;; ;;
*) *)
@ -30,8 +46,3 @@ case $DOJIGDO in
exit 1 exit 1
;; ;;
esac esac
# Likewise, the file size can be extracted from the .template with:
# tail --bytes=32 $$file | head --bytes=6 | od -tx1 -An \
# | tr ' abcdef' '\nABCDEF' | tac | tr '\n' ' ' \
# | sed -e 's/ //g; s/^.*$/ibase=16 & /' | tr ' ' '\n' | bc