전체 설치 스크립트 GitHub 릴리스 에셋 검증 및 폴백 다운로드 방어 로직 적용

This commit is contained in:
mcchae committed 2026-10-31 04:54:34 +09:00
1 parent 5a67e7bbcf
commit b41d2f68f3
21 files changed
+541 -190

No files matched your search

+15 -3
View File
@@ -51,8 +51,10 @@ if ($arch -ne "AMD64" -and $arch -ne "ARM64") {
$tag = $null
try {
Info "Fetching latest release tag from GitHub API..."
$response = Invoke-RestMethod -Uri $API_URL -TimeoutSec 10
$tag = $response.tag_name
$response = Invoke-RestMethod -Uri $API_URL -Headers @{ 'User-Agent' = 'install-all-smi-ps1' } -TimeoutSec 10
if ($response -and $response.assets -and $response.assets.Count -gt 0) {
$tag = $response.tag_name
}
} catch {
Warn "Failed to retrieve the latest version from GitHub API. Using fallback version: $FALLBACK_VERSION"
$tag = $FALLBACK_VERSION
@@ -63,6 +65,7 @@ if (-not $tag) {
}
$downloadUrl = "https://github.com/$REPO/releases/download/$tag/$assetName"
$fallbackUrl = "https://github.com/$REPO/releases/download/$FALLBACK_VERSION/$assetName"
Info "Resolved download URL: $downloadUrl"
# ────────────────────────────────────────────
@@ -80,7 +83,16 @@ $destFile = Join-Path $INSTALL_DIR "all-smi.exe"
try {
Info "Downloading binary archive..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempZip -UseBasicParsing
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempZip -UseBasicParsing
} catch {
if ($downloadUrl -ne $fallbackUrl) {
Warn "Primary download failed. Retrying with fallback version ($FALLBACK_VERSION): $fallbackUrl"
Invoke-WebRequest -Uri $fallbackUrl -OutFile $tempZip -UseBasicParsing
} else {
throw
}
}
if (Test-Path $tempExtractDir) {
Remove-Item $tempExtractDir -Recurse -Force