Add multi-source release download and Gitea acceleration fallback to installer and CLI update
Binaries / Build & Release Binaries (push) Has been cancelled
Binaries / Build & Release Binaries (push) Has been cancelled
This commit is contained in:
1 parent
ab7131ef2c
commit
7476db2bb5
2 files changed
+158
-94
No files matched your search
+39
-3
@@ -48,13 +48,49 @@ if [ -z "$TARGET_DIR" ]; then
|
||||
fi
|
||||
|
||||
ASSET_NAME="seal-home-${PLATFORM}-${ARCH_NAME}"
|
||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${ASSET_NAME}"
|
||||
TARGET_PATH="${TARGET_DIR}/seal-home"
|
||||
|
||||
echo "==> Downloading seal-home (${PLATFORM}-${ARCH_NAME}) into ${TARGET_DIR}..."
|
||||
TMP_FILE="$(mktemp)"
|
||||
if ! curl -fL "$DOWNLOAD_URL" -o "$TMP_FILE"; then
|
||||
echo "Error: Failed to download $DOWNLOAD_URL" >&2
|
||||
DOWNLOAD_SUCCESS=false
|
||||
|
||||
# Multi-source candidate mirrors
|
||||
GITEA_BASE="https://git.ying-qing.cn/gitea/seal-home"
|
||||
GITHUB_BASE="https://github.com/${REPO}"
|
||||
GHPROXY_BASE="https://ghfast.top/https://github.com/${REPO}"
|
||||
|
||||
# 1. Check Gitea mirror if responsive
|
||||
if [ "${SEAL_HOME_MIRROR:-auto}" = "gitea" ] || [ "${SEAL_HOME_MIRROR:-auto}" = "auto" ]; then
|
||||
if curl -s --connect-timeout 2 -I "https://git.ying-qing.cn" >/dev/null 2>&1; then
|
||||
GITEA_URL="${GITEA_BASE}/releases/download/latest/${ASSET_NAME}"
|
||||
if curl -fL --connect-timeout 4 "$GITEA_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||
echo "✓ Downloaded from high-speed mirror (git.ying-qing.cn)"
|
||||
DOWNLOAD_SUCCESS=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# 2. Try direct GitHub
|
||||
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||
GITHUB_URL="${GITHUB_BASE}/releases/latest/download/${ASSET_NAME}"
|
||||
if curl -fL --connect-timeout 6 "$GITHUB_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||
echo "✓ Downloaded from GitHub Releases"
|
||||
DOWNLOAD_SUCCESS=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. Fallback to GitHub CDN proxy
|
||||
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||
GHPROXY_URL="${GHPROXY_BASE}/releases/latest/download/${ASSET_NAME}"
|
||||
echo "==> Trying CDN fallback mirror..."
|
||||
if curl -fL "$GHPROXY_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||
echo "✓ Downloaded from CDN mirror"
|
||||
DOWNLOAD_SUCCESS=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||
echo "Error: Failed to download ${ASSET_NAME} from any available mirror." >&2
|
||||
rm -f "$TMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user