전체 설치 스크립트 GitHub 릴리스 에셋 검증 및 폴백 다운로드 방어 로직 적용
This commit is contained in:
1 parent
5a67e7bbcf
commit
b41d2f68f3
21 files changed
+541
-190
No files matched your search
+15
-3
@@ -127,7 +127,7 @@ function Get-DownloadUrl {
|
||||
# Download, extract & install
|
||||
# ────────────────────────────────────────────
|
||||
function Install-Dua {
|
||||
param([string]$Url)
|
||||
param([string]$Url, [string]$FallbackUrl)
|
||||
|
||||
$tmpDir = Join-Path $env:TEMP "dua_install_$(Get-Random)"
|
||||
New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
|
||||
@@ -141,7 +141,18 @@ function Install-Dua {
|
||||
Invoke-WebRequest -Uri $Url -OutFile $zipPath -UseBasicParsing
|
||||
$ProgressPreference = 'Continue'
|
||||
} catch {
|
||||
ErrExit "Download failed from $Url : $_"
|
||||
if ($FallbackUrl -and ($FallbackUrl -ne $Url)) {
|
||||
Warn "Primary download failed. Retrying with fallback URL: $FallbackUrl"
|
||||
try {
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
Invoke-WebRequest -Uri $FallbackUrl -OutFile $zipPath -UseBasicParsing
|
||||
$ProgressPreference = 'Continue'
|
||||
} catch {
|
||||
ErrExit "Download failed from $FallbackUrl : $_"
|
||||
}
|
||||
} else {
|
||||
ErrExit "Download failed from $Url : $_"
|
||||
}
|
||||
}
|
||||
|
||||
Info "Extracting archive..."
|
||||
@@ -218,7 +229,8 @@ function Main {
|
||||
Info "Release tag: $tag"
|
||||
|
||||
$url = Get-DownloadUrl -Tag $tag -Triple $triple
|
||||
$duaBin = Install-Dua -Url $url
|
||||
$fallbackUrl = Get-DownloadUrl -Tag $FALLBACK_TAG -Triple $triple
|
||||
$duaBin = Install-Dua -Url $url -FallbackUrl $fallbackUrl
|
||||
|
||||
if ($AddToPath) {
|
||||
Add-ToUserPath -Dir $InstallDir
|
||||
|
||||
Reference in new issue
Block a user