tools/imagesums: Add support for more checksum types. genisoimage

will shortly start generating sha256 and sha512 sums too.
This commit is contained in:
Steve McIntyre 2009-05-10 23:12:52 +00:00
parent c875c30056
commit 5dd663686e
2 changed files with 32 additions and 30 deletions

4
debian/changelog vendored
View File

@ -19,6 +19,10 @@ debian-cd (3.1.2) UNRELEASED; urgency=low
* Add firmware-linux to firmware task.
* Re-add zd1211-firmware to firmware task.
[ Steve McIntyre ]
* tools/imagesums: Add support for more checksum types. genisoimage
will shortly start generating sha256 and sha512 sums too.
-- Frans Pop <fjp@debian.org> Sun, 15 Feb 2009 23:41:25 +0100
debian-cd (3.1.1) unstable; urgency=high

View File

@ -6,8 +6,14 @@ if [ "$2"x != ""x ] ; then
EXT="$2"
fi
:> MD5SUMS$EXT
:> SHA1SUMS$EXT
CHECKSUMS="sha1 md5" # sha512 sha256
for SUM in $CHECKSUMS; do
UPSUM=`echo $SUM | tr 'a-z' 'A-Z'`
FILE=$UPSUM"SUMS"$EXT
echo "Clearing $FILE"
:> $FILE
done
# 2 calls to find here to get the ordering right - we *really* want to
# get the jigdo files first
@ -27,34 +33,26 @@ for file in `find * -name \*.jigdo` `find * -name \*.iso`; do
;;
esac
grep -q $iso MD5SUMS$EXT
if [ $? -ne 0 ] ; then
MD5=""
if [ "$JIGDO" == 1 ] ; then
MD5=`zcat -f $file | awk '/Image Hex MD5Sum/ {print $5}'`
fi
if [ "$MD5"x != ""x ] ; then
echo "$MD5 $iso" >> MD5SUMS$EXT
else
echo "No Jigdo help for md5, doing it the long way"
md5sum $iso >> MD5SUMS$EXT
grep $iso MD5SUMS$EXT
fi
fi
for SUM in $CHECKSUMS; do
UPSUM=`echo $SUM | tr 'a-z' 'A-Z'`
FILE=$UPSUM"SUMS"$EXT
SEARCH="$UPSUM"Sum
CMD="$SUM"sum
grep -q $iso SHA1SUMS$EXT
if [ $? -ne 0 ] ; then
SHA1=""
if [ "$JIGDO" == 1 ] ; then
SHA1=`zcat -f $file | awk '/Image Hex SHA1Sum/ {print $5}'`
fi
if [ "$SHA1"x != ""x ] ; then
echo "$SHA1 $iso" >> SHA1SUMS$EXT
else
echo "No Jigdo help for sha1, doing it the long way"
sha1sum $iso >> SHA1SUMS$EXT
grep $iso SHA1SUMS$EXT
fi
fi
grep -q $iso $FILE
if [ $? -ne 0 ] ; then
CKSUM=""
if [ "$JIGDO" == 1 ] ; then
CKSUM=`zcat -f $file | awk "/Image Hex $SEARCH/ {print \\$5}"`
fi
if [ "$CKSUM"x != ""x ] ; then
echo "$CKSUM $iso" >> $FILE
else
echo "No Jigdo help for $SUM, doing it the long way with $CMD"
$CMD $iso >> $FILE
grep $iso $FILE
fi
fi
done
done