#!/bin/sh

for FILE in $(find . -not '(' -name "sign.sh" -or -name ".*" -or -name "*.md5" -or -name "*.sha1" -or -name "*.asc" ')' -and -type f) ; do
    # Generate a SHA-512 if there is an SHA1 file
    if [ -f "$FILE.sha1" ];
    then
        CHECKSUM=`openssl dgst -sha512 < "$FILE"`
        FILENAME=`echo "$FILE" | sed 's/.*\///'`
        echo "$CHECKSUM *$FILENAME" > "$FILE".sha512
        echo "Generated '$FILE.sha512'"
    fi
done