Skip to content

Commit

Permalink
fix(install-witness.sh): ensure compatibility with macOS for checksum…
Browse files Browse the repository at this point in the history
… verification (#459)

The install-witness.sh script did not work on macOS due to the absence of the sha256sum command.
This patch adds a check to use shasum -a 256 if sha256sum is not available, ensuring the script
runs correctly on macOS.

- Added a conditional check to use shasum -a 256 when sha256sum is not found
- Updated the FILE_CHECKSUM assignment to support both commands

Closes #458

Signed-off-by: Frederick F. Kautz IV <[email protected]>
  • Loading branch information
fkautz authored Jun 1, 2024
1 parent fa44388 commit b495cf7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion install-witness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ cd "$TEMPDIR"
curl -s -LO "$DOWNLOAD_URL"

# Verify the checksum
FILE_CHECKSUM=$(sha256sum -b "witness_${VERSION}_${OS}_${ARCH}.tar.gz" | awk '{print $1}')
if command -v sha256sum >/dev/null 2>&1; then
FILE_CHECKSUM=$(sha256sum -b "witness_${VERSION}_${OS}_${ARCH}.tar.gz" | awk '{print $1}')
else
FILE_CHECKSUM=$(shasum -a 256 "witness_${VERSION}_${OS}_${ARCH}.tar.gz" | awk '{print $1}')
fi

echo file checksum: " $FILE_CHECKSUM"

Expand Down

0 comments on commit b495cf7

Please sign in to comment.