From 41da1d2def211b7671ceb28293efaece4dddf818 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:49:32 +0200 Subject: [PATCH] Update github.func --- misc/github.func | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/misc/github.func b/misc/github.func index 6c8d7b9..c85ee75 100644 --- a/misc/github.func +++ b/misc/github.func @@ -1,4 +1,5 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) + get_gh_release() { set -Eeuo pipefail trap 'echo -e "\nāŒ [get_gh_release] Error on line $LINENO: $BASH_COMMAND"' ERR @@ -11,6 +12,8 @@ get_gh_release() { local max_attempts=3 local api_response tag + echo "šŸ” Checking latest release for: $repo" + [[ -n "${GITHUB_TOKEN:-}" ]] && header=(-H "Authorization: token $GITHUB_TOKEN") until [[ $attempt -ge $max_attempts ]]; do @@ -45,7 +48,10 @@ get_gh_release() { msg_ok "Found release: $tag for $repo" local version_file="/opt/${app}_version.txt" - [[ ! -f "$version_file" ]] && echo "$tag" >"$version_file" + if [[ ! -f "$version_file" ]]; then + echo "$tag" >"$version_file" + echo "šŸ“ Saved version info to $version_file" + fi echo "$tag" return 0 @@ -67,13 +73,14 @@ fetch_and_extract_gh_release() { temp_file=$(mktemp) local tarball_url="https://github.com/$repo/archive/refs/tags/v$tag.tar.gz" - msg_info "Downloading tarball for $app..." + msg_info "Downloading tarball for $app from $tarball_url..." if ! curl -fsSL "$tarball_url" -o "$temp_file"; then msg_error "Failed to download tarball: $tarball_url" return 1 fi mkdir -p "/opt/$app" + echo "šŸ“¦ Extracting tarball to /opt/$app..." tar -xzf "$temp_file" -C /opt mv "/opt/${app}-${tag}"/* "/opt/$app/" 2>/dev/null || msg_warn "Could not move extracted files." rm -rf "/opt/${app}-${tag}"