debian-cd-clone/tools/imagesums

38 lines
845 B
Plaintext
Raw Normal View History

#!/bin/bash
cd $1
:> MD5SUMS
2006-11-25 02:20:51 -01:00
case $DOJIGDO in
0)
2006-11-27 16:03:22 -01:00
for file in `find * -name \*.iso`
do
md5sum $file >> MD5SUMS
done
;;
1|2)
for file in `find * -name \*.template`
do
if [ "`tail --bytes=33 "$file" | head --bytes=1 | od -tx1 -An | sed -e 's/ //g'`" != 05 ]; then
echo "Possibly invalid template $file"
exit
fi
2006-11-27 16:03:22 -01:00
grep -q " ${file%%.template}.iso"'$$' MD5SUMS \
|| echo "`tail --bytes=26 "$file" | \
head --bytes=16 | \
od -tx1 -An | \
2006-12-05 16:52:07 -01:00
sed -e 's/ //g'` ${file%%.template}.iso" >> MD5SUMS
done
;;
*)
2006-11-25 02:20:51 -01:00
echo "DOJIGDO not defined!"
exit 1
;;
esac
2006-12-03 15:40:12 -01:00
# 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