전체 설치 스크립트 GitHub 릴리스 에셋 검증 및 폴백 다운로드 방어 로직 적용
This commit is contained in:
1 parent
5a67e7bbcf
commit
b41d2f68f3
21 files changed
+541
-190
No files matched your search
+11
-2
@@ -145,13 +145,22 @@ install_from_github() {
|
||||
tag="$(get_latest_tag)"
|
||||
local filename="dua-${tag}-${target}.tar.gz"
|
||||
local download_url="https://github.com/${REPO}/releases/download/${tag}/${filename}"
|
||||
local fallback_filename="dua-${FALLBACK_TAG}-${target}.tar.gz"
|
||||
local fallback_url="https://github.com/${REPO}/releases/download/${FALLBACK_TAG}/${fallback_filename}"
|
||||
|
||||
info "Downloading: $download_url"
|
||||
TMPDIR="$(mktemp -d)"
|
||||
trap '[[ -d "${TMPDIR:-}" ]] && rm -rf "$TMPDIR"' EXIT
|
||||
|
||||
curl -fsSL --progress-bar -o "${TMPDIR}/${filename}" "$download_url" ||
|
||||
error "Download failed: $download_url"
|
||||
if ! curl -fsSL --progress-bar -o "${TMPDIR}/${filename}" "$download_url"; then
|
||||
if [[ "$tag" != "$FALLBACK_TAG" ]]; then
|
||||
warn "Primary download failed. Retrying with fallback tag (${FALLBACK_TAG}): $fallback_url"
|
||||
curl -fsSL --progress-bar -o "${TMPDIR}/${filename}" "$fallback_url" ||
|
||||
error "Download failed: $fallback_url"
|
||||
else
|
||||
error "Download failed: $download_url"
|
||||
fi
|
||||
fi
|
||||
|
||||
info "Extracting..."
|
||||
tar -xzf "${TMPDIR}/${filename}" -C "$TMPDIR"
|
||||
|
||||
Reference in new issue
Block a user