Skip to content

Commit

Permalink
download_and_checksum: Read checksum from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 5, 2023
1 parent ebb475e commit 39c4617
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ download_and_checksum() {
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" -o tmp
if [[ -n "${checksum}" ]]; then
info "verifying sha256 checksum for $(basename "${url}")"
echo "${checksum} *tmp" >tmp.sha256sum
if type -P sha256sum &>/dev/null; then
sha256sum -c tmp.sha256sum >/dev/null
echo "${checksum} *tmp" | sha256sum -c - >/dev/null
elif type -P shasum &>/dev/null; then
# GitHub-hosted macOS runner does not install GNU Coreutils by default.
# https://github.com/actions/runner-images/issues/90
shasum -a 256 -c tmp.sha256sum >/dev/null
echo "${checksum} *tmp" | shasum -a 256 -c - >/dev/null
else
bail "checksum requires 'sha256sum' or 'shasum' command; consider installing one of them or setting 'checksum' input option to 'false'"
fi
Expand Down

0 comments on commit 39c4617

Please sign in to comment.