전체 설치 스크립트 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에서 Open Code Review 최신 릴리즈 정보를 가져오는 중..."
if json=$(curl -fsSL --connect-timeout 10 "${API_URL}" 2>/dev/null); then
if json=$(curl -fsSL -H "User-Agent: install-ocr-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 asset_name tag url tmpdir dest_file
local asset_name tag url fallback_url tmpdir dest_file
asset_name="$(detect_platform)"
info "감지된 플랫폼 에셋: $asset_name"
@@ -101,6 +101,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)"
@@ -110,7 +111,12 @@ main() {
info "바이너리 다운로드 중: $url"
if ! curl -fsSL --progress-bar -o "$dest_file" "$url"; then
error "다운로드 실패: $url"
if [[ "$tag" != "$FALLBACK_VERSION" ]]; then
warn "최신 버전(${tag}) 다운로드 실패. 검증된 폴백 버전(${FALLBACK_VERSION})으로 재시도합니다: $fallback_url"
curl -fsSL --progress-bar -o "$dest_file" "$fallback_url" || error "다운로드 실패: $fallback_url"
else
error "다운로드 실패: $url"
fi
fi
# 설치 디렉토리 확보