Skip to content

Commit

Permalink
feat: Skip verifying downloaded file checksum integrity if ASDF_ODO_C…
Browse files Browse the repository at this point in the history
…HECKS_SKIP_FILE_CHECKSUM is defined and set to true
  • Loading branch information
rm3l committed Apr 27, 2022
1 parent 33c2a1c commit fb0db97
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ download_release() {
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
log_verbose "Downloaded file $filename"

echo "* Verifying filename integrity..."
shaurl="${url}.sha256"
log_verbose "Download URL: " "$shaurl" ", using curl options: '${curl_opts[@]}'"
shafilename="$filename.sha256"
curl "${curl_opts[@]}" -o "$shafilename" -C - "$shaurl" || fail "Could not download $shaurl"
(echo "$(<$shafilename) $filename" | shasum -a 256 --check) || fail "Could not check integrity of downloaded file"
if [[ "${ASDF_ODO_CHECKS_SKIP_FILE_CHECKSUM:-false}" != "true" ]]; then
echo "* Verifying filename integrity..."
shaurl="${url}.sha256"
log_verbose "Download URL: " "$shaurl" ", using curl options: '${curl_opts[@]}'"
shafilename="$filename.sha256"
curl "${curl_opts[@]}" -o "$shafilename" -C - "$shaurl" || fail "Could not download $shaurl"
(echo "$(<$shafilename) $filename" | shasum -a 256 --check) || fail "Could not check integrity of downloaded file"
fi

chmod a+x "$filename"
}
Expand Down

0 comments on commit fb0db97

Please sign in to comment.