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:
parent
73f31c1b5a
commit
bcdd6107b9
|
@ -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
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
MD5=`zcat -f $file | awk '/Image Hex MD5Sum/ {print $5}'`
|
||||||
|
if [ "$MD5"x != ""x ] ; then
|
||||||
|
echo "$MD5 $iso" >> MD5SUMS
|
||||||
|
else
|
||||||
|
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
|
fi
|
||||||
grep -q " ${file%%.template}.iso"'$$' MD5SUMS \
|
|
||||||
|| echo "`tail --bytes=26 "$file" | \
|
|
||||||
head --bytes=16 | \
|
|
||||||
od -tx1 -An | \
|
|
||||||
sed -e 's/ //g'` ${file%%.template}.iso" >> MD5SUMS
|
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in New Issue