File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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()
Original file line number Diff line number Diff 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 ; }
3434error () { printf ' \033[0;31m[ERROR]\033[0m %s\n' " $* " >&2 ; }
3535die () {
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
You can’t perform that action at this time.
0 commit comments