Skip to content

Commit f0f3a8f

Browse files
committed
fix(install): fix checksum matching and stdout pollution
1 parent a5a3ca4 commit f0f3a8f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function Download-And-Verify {
181181
try {
182182
Invoke-DownloadWithRetry -Url $ChecksumUrl -OutFile $ChecksumPath
183183
$checksumContent = Get-Content $ChecksumPath -Raw
184-
$entry = ($checksumContent -split "`n") | Where-Object { $_ -match [regex]::Escape($ArchiveName) }
184+
$entry = ($checksumContent -split "`r?`n") | Where-Object { $_ -match ('\s' + [regex]::Escape($ArchiveName) + '$') }
185185
if ($entry) {
186186
$expected = ($entry -split '\s+')[0].Trim()
187187
$actual = (Get-FileHash -Algorithm SHA256 $ArchivePath).Hash.ToLower()

install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ CURL_MAX_TIME=120
2929
# ---------------------------------------------------------------------------
3030
# Helpers
3131
# ---------------------------------------------------------------------------
32-
info() { printf '\033[0;32m[INFO]\033[0m %s\n' "$*"; }
33-
warn() { printf '\033[0;33m[WARN]\033[0m %s\n' "$*"; }
32+
info() { printf '\033[0;32m[INFO]\033[0m %s\n' "$*" >&2; }
33+
warn() { printf '\033[0;33m[WARN]\033[0m %s\n' "$*" >&2; }
3434
error() { printf '\033[0;31m[ERROR]\033[0m %s\n' "$*" >&2; }
3535
die() {
3636
error "$*"
@@ -235,7 +235,7 @@ download_and_verify() {
235235
if curl_with_retry "$CHECKSUM_URL" "$CHECKSUM_PATH" 2>/dev/null; then
236236
info "Verifying checksum..."
237237
# Extract the expected checksum for our archive
238-
EXPECTED="$(grep "${ARCHIVE_NAME}" "$CHECKSUM_PATH" | awk '{print $1}')"
238+
EXPECTED="$(grep -E "[[:space:]]${ARCHIVE_NAME}[[:space:]]*\$" "$CHECKSUM_PATH" | awk '{print $1}')"
239239
if [ -z "$EXPECTED" ]; then
240240
warn "Checksum entry not found for ${ARCHIVE_NAME}, skipping verification."
241241
else

0 commit comments

Comments
 (0)