전체 설치 스크립트 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

+10 -4
View File
@@ -71,9 +71,9 @@ get_latest_tag() {
local json tag
info "GitHub API에서 all-smi 최신 릴리즈 정보를 가져오는 중..."
if json=$(curl -fsSL --connect-timeout 10 "${API_URL}" 2>/dev/null); then
if json=$(curl -fsSL -H "User-Agent: install-all-smi-sh" --connect-timeout 10 "${API_URL}" 2>/dev/null); then
if command -v jq &>/dev/null; then
tag=$(echo "$json" | jq -r '.tag_name')
tag=$(echo "$json" | jq -r 'select((.assets | length) > 0) | .tag_name')
else
# jq가 없는 경우 grep & sed 사용
tag=$(echo "$json" | grep '"tag_name":' | head -n 1 | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/')
@@ -92,7 +92,7 @@ get_latest_tag() {
# 메인 설치 함수
# ────────────────────────────────────────────
main() {
local platform_info asset_name format tag url tmpdir archive_file bin_src
local platform_info asset_name format tag url fallback_url tmpdir archive_file bin_src
platform_info="$(detect_platform)"
asset_name="${platform_info%%:*}"
@@ -104,6 +104,7 @@ main() {
info "적용할 버전 태그: $tag"
url="https://github.com/${REPO}/releases/download/${tag}/${asset_name}"
fallback_url="https://github.com/${REPO}/releases/download/${FALLBACK_VERSION}/${asset_name}"
# 임시 디렉토리 생성
tmpdir="$(mktemp -d)"
@@ -113,7 +114,12 @@ main() {
info "바이너리 아카이브 다운로드 중: $url"
if ! curl -fsSL --progress-bar -o "$archive_file" "$url"; then
error "다운로드 실패: $url"
if [[ "$tag" != "$FALLBACK_VERSION" ]]; then
warn "최신 버전(${tag}) 다운로드 실패. 검증된 폴백 버전(${FALLBACK_VERSION})으로 재시도합니다: $fallback_url"
curl -fsSL --progress-bar -o "$archive_file" "$fallback_url" || error "다운로드 실패: $fallback_url"
else
error "다운로드 실패: $url"
fi
fi
info "압축 해제 중..."