Asif Bacchus
4456653f03
- fix script checksumming checksum file itself - move to target directory only after all checksums completed
30 lines
680 B
Bash
Executable File
30 lines
680 B
Bash
Executable File
#!/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 {} + >>./checksums.sha256
|
|
sed -i "s+$srcDir/++g" ./checksums.sha256
|
|
\mv ./checksums.sha256 "${srcDir}/"
|
|
|
|
# exit gracefully
|
|
exit 0
|
|
|
|
#EOF
|