Skip to content

Commit fdab7f7

Browse files
Fix bug in checksum validation logic
1 parent 5b763a7 commit fdab7f7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

scripts/install.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,18 @@ verify_checksum() {
280280

281281
cd "${tmp_dir}"
282282

283+
# Format checksum for validation: "hash filename"
284+
local formatted_checksum
285+
formatted_checksum=$(printf "%s %s\n" "$(cat "${checksum_file}" | tr -d '[:space:]')" "${filename}")
286+
283287
if command -v sha256sum >/dev/null 2>&1; then
284-
if sha256sum -c "${checksum_file}" >/dev/null 2>&1; then
285-
log_success "Checksum validation passed"
286-
else
288+
if ! echo "${formatted_checksum}" | sha256sum -c >/dev/null 2>&1; then
287289
log_error "Checksum validation failed using sha256sum"
288290
log_error "For security reasons, installation has been aborted"
289291
exit 1
290292
fi
291293
elif command -v shasum >/dev/null 2>&1; then
292-
if shasum -a 256 -c "${checksum_file}" >/dev/null 2>&1; then
293-
log_success "Checksum validation passed"
294-
else
294+
if ! echo "${formatted_checksum}" | shasum -a 256 -c >/dev/null 2>&1; then
295295
log_error "Checksum validation failed using shasum"
296296
log_error "For security reasons, installation has been aborted"
297297
exit 1
@@ -363,8 +363,6 @@ copy_binary_to_install_dir() {
363363
else
364364
sudo cp "${binary_path}" "${install_dir}/${BINARY_NAME}"
365365
fi
366-
367-
log_success "Tiger CLI installed successfully!"
368366
}
369367

370368

@@ -383,7 +381,8 @@ verify_installation() {
383381
local installed_version
384382
if installed_version=$("${binary_path}" version 2>/dev/null | head -n1 || echo ""); then
385383
if [ -n "${installed_version}" ]; then
386-
log_success "Installation verified: ${installed_version}"
384+
log_success "Tiger CLI installed successfully!"
385+
log_success "Version: ${installed_version}"
387386
else
388387
log_success "Binary installed successfully at ${binary_path}"
389388
fi

0 commit comments

Comments
 (0)