diff --git a/devUtils/generateHelperChecksums.sh b/devUtils/generateHelperChecksums.sh new file mode 100644 index 0000000..a3f6645 --- /dev/null +++ b/devUtils/generateHelperChecksums.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# +# generate checksums from provided path suitable for use by 'update.sh' +# + +# check for missing path to helper files, otherwise strip trailing slash +if [ -z "$1" ]; then + printf "\nPlease supply path to helper files. Exiting.\n\n" + exit 1 +fi +srcDir="${1%/}" + +# verify path exists and is accessible +if ! [ -d "$srcDir" ]; then + printf "\nUnable to find or read supplied path to helper files. Exiting.\n\n" + exit 1 +fi + +# generate checksum file +\rm -f "${srcDir}/checksums.sha256" +find "${srcDir}/" -type f -exec sha256sum {} + >>"${srcDir}/checksums.sha256" +sed -i "s+$srcDir/++g" "${srcDir}/checksums.sha256" + +# exit gracefully +exit 0 + +#EOF