debian-cd-clone/contrib/merge-sums

41 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
export LANG=C
export LC_ALL=C
if [ "$1"x = ""x ] ; then
echo "$0: tell me which dir to target!"
echo "abort"
exit 1
fi
CHECK=`ls -al $1/*/iso-* 2>/dev/null`
if [ "$CHECK"x = ""x ] ; then
echo "$0: could not find stuff to work on in $1"
echo "abort"
exit 1
fi
for DIR in $1/*/*-*; do
cd $DIR
CHECK=`ls -al *SUMS.* 2>/dev/null`
if [ "$CHECK"x != ""x ] ; then
cat MD5SUMS.* | sort -k2 | uniq > MD5SUMS
cat SHA1SUMS.* | sort -k2 | uniq > SHA1SUMS
cat SHA256SUMS.* | sort -k2 | uniq > SHA256SUMS
cat SHA512SUMS.* | sort -k2 | uniq > SHA512SUMS
for ISOFILE in `cat MD5SUMS SHA1SUMS | awk '{print $2}'`; do
JIGDOFILE=${ISOFILE%iso}jigdo
TEMPLATEFILE=${ISOFILE%iso}template
if [ ! -e $ISOFILE ] && [ ! -e $JIGDOFILE ] && [ ! -e $TEMPLATEFILE ] ; then
echo "$ISOFILE/$JIGDOFILE/$TEMPLATEFILE missing in $DIR!"
# echo "abort"
# exit 1
fi
done
echo "$DIR done"
else
echo "Ignoring $DIR: no checksum files"
fi
done