Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,15 @@ verify_checksum() {
_vc_expected="$(grep "$_vc_filename" "$_vc_checksums" | awk '{print $1}')"

if [ -z "$_vc_expected" ]; then
warn "no checksum found for $_vc_filename, skipping verification"
return 0
error "no checksum found for $_vc_filename in checksums file"
fi

if has_cmd shasum; then
echo "$_vc_expected $_vc_archive" | shasum -a 256 -c --quiet 2>/dev/null
elif has_cmd sha256sum; then
echo "$_vc_expected $_vc_archive" | sha256sum -c --quiet 2>/dev/null
else
warn "sha256sum/shasum not found, skipping checksum verification"
return 0
error "sha256sum or shasum is required to verify checksums"
fi
}

Expand Down Expand Up @@ -256,12 +254,11 @@ main() {

# Verify checksum
info "verifying checksum..."
if download "$_checksums_url" "${_tmpdir}/checksums.txt"; then
if ! verify_checksum "${_tmpdir}/${_filename}" "${_tmpdir}/checksums.txt" "$_filename"; then
error "checksum verification failed for ${_filename}"
fi
else
warn "could not download checksums file, skipping verification"
if ! download "$_checksums_url" "${_tmpdir}/checksums.txt"; then
error "could not download checksums file from ${_checksums_url}"
fi
if ! verify_checksum "${_tmpdir}/${_filename}" "${_tmpdir}/checksums.txt" "$_filename"; then
error "checksum verification failed for ${_filename}"
fi

# Extract
Expand Down
Loading