From d4c59caf12eac32065c12916907b95681b334c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Mon, 28 Jul 2025 14:57:44 +0200 Subject: [PATCH] Refactor (#6305) --- ct/argus.sh | 19 +++++++++++-------- install/argus-install.sh | 13 +------------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/ct/argus.sh b/ct/argus.sh index 3a813a052..cae3fa28a 100644 --- a/ct/argus.sh +++ b/ct/argus.sh @@ -23,20 +23,23 @@ function update_script() { header_info check_container_storage check_container_resources - if [[ ! -d /opt/argus ]]; then msg_error "No ${APP} Installation Found!" exit fi RELEASE=$(curl -fsSL https://api.github.com/repos/release-argus/Argus/releases/latest | jq -r .tag_name | sed 's/^v//') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Updating $APP to ${RELEASE}" - rm -f /opt/argus/Argus - curl -fsSL "https://github.com/release-argus/Argus/releases/download/${RELEASE}/Argus-${RELEASE}.linux-amd64" -o /opt/argus/Argus - chmod +x /opt/argus/Argus - systemctl restart argus - echo "${RELEASE}" >/opt/${APP}_version.txt + if [[ "${RELEASE}" != "$(cat ~/.Argus 2>/dev/null)" ]] || [[ ! -f ~/.Argus ]]; then + msg_info "Stopping service" + systemctl stop argus + msg_ok "Service stopped" + + fetch_and_deploy_gh_release "Argus" "release-argus/Argus" "singlefile" "latest" "/opt/argus" "Argus*linux-amd64" + + msg_info "Starting service" + systemctl start argus + msg_ok "Service started" + msg_ok "Updated ${APP} to ${RELEASE}" else msg_ok "${APP} is already up to date (${RELEASE})" diff --git a/install/argus-install.sh b/install/argus-install.sh index 9d92ce708..60540eaab 100644 --- a/install/argus-install.sh +++ b/install/argus-install.sh @@ -13,17 +13,7 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y \ - jq -msg_ok "Installed Dependencies" - -msg_info "Setup Argus" -RELEASE=$(curl -fsSL https://api.github.com/repos/release-argus/Argus/releases/latest | jq -r .tag_name | sed 's/^v//') -mkdir -p /opt/argus -curl -fsSL "https://github.com/release-argus/Argus/releases/download/${RELEASE}/Argus-${RELEASE}.linux-amd64" -o /opt/argus/Argus -chmod +x /opt/argus/Argus -msg_ok "Setup Argus" +fetch_and_deploy_gh_release "Argus" "release-argus/Argus" "singlefile" "latest" "/opt/argus" "Argus*linux-amd64" msg_info "Setup Argus Config" cat </opt/argus/config.yml @@ -71,7 +61,6 @@ service: icon_link_to: https://helper-scripts.com/ web_url: https://github.com/community-scripts/ProxmoxVE/releases EOF -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup Config" msg_info "Creating Service"