2008-01-19 19:06:44 -01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd $1
|
|
|
|
|
2008-12-17 22:31:09 -01:00
|
|
|
if [ "$2"x != ""x ] ; then
|
|
|
|
EXT=".$2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
:> MD5SUMS$EXT
|
|
|
|
:> SHA1SUMS$EXT
|
2008-01-19 19:06:44 -01:00
|
|
|
|
|
|
|
case $DOJIGDO in
|
|
|
|
0)
|
|
|
|
for file in `find * -name \*.iso`
|
|
|
|
do
|
2008-12-17 22:31:09 -01:00
|
|
|
md5sum $file >> MD5SUMS$EXT
|
|
|
|
sha1sum $file >> SHA1SUMS$EXT
|
2008-01-19 19:06:44 -01:00
|
|
|
done
|
|
|
|
;;
|
|
|
|
1|2)
|
2008-07-18 12:23:28 +00:00
|
|
|
for file in `find * -name \*.jigdo`
|
2008-01-19 19:06:44 -01:00
|
|
|
do
|
2008-07-18 12:23:28 +00:00
|
|
|
iso=${file%%.jigdo}.iso
|
|
|
|
|
2008-12-17 22:31:09 -01:00
|
|
|
grep -q $iso MD5SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
MD5=`zcat -f $file | awk '/Image Hex MD5Sum/ {print $5}'`
|
|
|
|
if [ "$MD5"x != ""x ] ; then
|
2008-12-17 22:31:09 -01:00
|
|
|
echo "$MD5 $iso" >> MD5SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
else
|
|
|
|
echo "Jigdo file does not contain the Image MD5, calculating by hand"
|
2008-12-17 22:31:09 -01:00
|
|
|
md5sum $iso >> MD5SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-12-17 22:31:09 -01:00
|
|
|
grep -q $iso SHA1SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
SHA1=`zcat -f $file | awk '/Image Hex SHA1Sum/ {print $5}'`
|
|
|
|
if [ "$SHA1"x != ""x ] ; then
|
2008-12-17 22:31:09 -01:00
|
|
|
echo "$SHA1 $iso" >> SHA1SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
else
|
|
|
|
echo "Jigdo file does not contain the Image SHA1, calculating by hand"
|
2008-12-17 22:31:09 -01:00
|
|
|
sha1sum $iso >> SHA1SUMS$EXT
|
2008-07-18 12:23:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
2008-01-19 19:06:44 -01:00
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "DOJIGDO not defined!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|