Compare commits

...

2 Commits

Author SHA1 Message Date
e6c331575a Make target file relative to script file
Since we expect them to be in the same directory
2025-11-24 12:07:34 -08:00
0e6f27a4f2 Add explanation to script template 2025-11-24 12:07:16 -08:00

View File

@@ -1,10 +1,26 @@
#!/bin/env sh
# This script should have come along with two files:
# * The target file '{filename}'
# * The signature file '{filename}.sh.sig'
# (or this file should have been signed in some other way)
#
# First, you should verify that this file came from the person you expect by
# verifying the signature.
#
# Next, you should run this script which will check that the target file
# matches the hash that was calculated when the message below was written.
# This will confirm that the file you have matches the file the message was
# written about.
#
# Alternatively, if you don't want to run this script, you can verify the
# hash manually.
MESSAGE="{message}"
FILE="{filename}"
FILE_PATH="$(dirname "$0")/$FILE"
EXPECTED_HASH="{filehash}"
if [ "$(sha256sum "$FILE" | awk '{print $1}')" = "$EXPECTED_HASH" ]; then
if [ "$(sha256sum "$FILE_PATH" | awk '{print $1}')" = "$EXPECTED_HASH" ]; then
printf "File %s validated with message:\\n%s" "$FILE" "$MESSAGE"
exit 0
else