2006-11-25 01:08:38 -01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd $1
|
|
|
|
|
2008-12-17 22:34:11 -01:00
|
|
|
if [ "$2"x != ""x ] ; then
|
2008-12-26 00:08:44 -01:00
|
|
|
EXT="$2"
|
2008-12-17 22:34:11 -01:00
|
|
|
fi
|
|
|
|
|
|
|
|
:> MD5SUMS$EXT
|
|
|
|
:> SHA1SUMS$EXT
|
2006-11-25 01:08:38 -01:00
|
|
|
|
2008-09-10 22:16:18 +00:00
|
|
|
# 2 calls to find here to get the ordering right - we *really* want to
|
|
|
|
# get the jigdo files first
|
|
|
|
for file in `find * -name \*.jigdo` `find * -name \*.iso`; do
|
|
|
|
case $file in
|
|
|
|
*.jigdo)
|
2008-04-20 14:33:19 +00:00
|
|
|
iso=${file%%.jigdo}.iso
|
2008-09-10 22:16:18 +00:00
|
|
|
JIGDO=1
|
|
|
|
;;
|
|
|
|
*.iso)
|
|
|
|
iso=$file
|
|
|
|
JIGDO=0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Found unexpected file $file!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2008-04-20 14:33:19 +00:00
|
|
|
|
2008-12-17 22:34:11 -01:00
|
|
|
grep -q $iso MD5SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
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
|
2008-12-17 22:34:11 -01:00
|
|
|
echo "$MD5 $iso" >> MD5SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
else
|
|
|
|
echo "No Jigdo help for md5, doing it the long way"
|
2008-12-17 22:34:11 -01:00
|
|
|
md5sum $iso >> MD5SUMS$EXT
|
|
|
|
grep $iso MD5SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
fi
|
|
|
|
fi
|
2008-04-20 14:33:19 +00:00
|
|
|
|
2008-12-17 22:34:11 -01:00
|
|
|
grep -q $iso SHA1SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
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
|
2008-12-17 22:34:11 -01:00
|
|
|
echo "$SHA1 $iso" >> SHA1SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
else
|
|
|
|
echo "No Jigdo help for sha1, doing it the long way"
|
2008-12-17 22:34:11 -01:00
|
|
|
sha1sum $iso >> SHA1SUMS$EXT
|
|
|
|
grep $iso SHA1SUMS$EXT
|
2008-09-10 22:16:18 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|