From f5a5b93b2e473d2ab0d5f83cccd3fb832662e81a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:24:09 +0200 Subject: [PATCH] Update install.func --- misc/install.func | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/misc/install.func b/misc/install.func index 6ec0296..e99fe33 100644 --- a/misc/install.func +++ b/misc/install.func @@ -222,7 +222,7 @@ EOF get_gh_release() { local repo="$1" - local app="${repo##*/}" # extract the app name from the repo URL + local app="${repo##*/}" local api_url="https://api.github.com/repos/$repo/releases/latest" local header=() local attempt=0 @@ -234,6 +234,7 @@ get_gh_release() { until [[ $attempt -ge $max_attempts ]]; do ((attempt++)) msg_info "[$attempt/$max_attempts] Fetching GitHub release for $repo" + if ! api_response=$(curl -fsSL "${header[@]}" "$api_url"); then msg_warn "Request failed for $repo, retrying..." sleep 2 @@ -241,7 +242,7 @@ get_gh_release() { fi if echo "$api_response" | grep -q "API rate limit exceeded"; then - msg_error "GitHub API rate limit exceeded. Set GITHUB_TOKEN to increase limit." + msg_error "GitHub API rate limit exceeded." return 1 fi @@ -261,15 +262,14 @@ get_gh_release() { msg_ok "Found release: $tag for $repo" - # save version to file local version_file="/opt/${app}_version.txt" [[ ! -f "$version_file" ]] && echo "$tag" >"$version_file" - # Download and extract local temp_file temp_file=$(mktemp) local tarball_url="https://github.com/$repo/archive/refs/tags/v$tag.tar.gz" - msg_info "Downloading tarball for $repo..." + msg_info "Downloading tarball..." + if ! curl -fsSL "$tarball_url" -o "$temp_file"; then msg_error "Failed to download tarball: $tarball_url" return 1