From 34113208ffd757a6106049a168ce466e50774878 Mon Sep 17 00:00:00 2001 From: Bas van den Berg <74251551+bvdberg01@users.noreply.github.com> Date: Sun, 20 Jul 2025 15:40:27 +0200 Subject: [PATCH] Update ots.sh --- ct/ots.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/ct/ots.sh b/ct/ots.sh index d089bd80..e3e03df9 100644 --- a/ct/ots.sh +++ b/ct/ots.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG -# Author: BvdBerg01 +# Author: bvdberg01 # License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE # Source: https://github.com/Luzifer/ots APP="OTS" -var_tags="${var_tags:-analytics}" +var_tags="${var_tags:-secrets-sharer}" var_cpu="${var_cpu:-1}" var_ram="${var_ram:-512}" var_disk="${var_disk:-3}" @@ -27,10 +27,25 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" + + RELEASE=$(curl -fsSL https://api.github.com/repos/Luzifer/ots/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + msg_info "Stopping ${APP} Service" + systemctl stop ots + msg_ok "Stopped ${APP} Service" + + msg_info "Updating ${APP} to v${RELEASE}" + fetch_and_deploy_gh_release "ots" "Luzifer/ots" "prebuild" "latest" "/opt/ots" "ots_linux_amd64.tgz" + msg_ok "Updated ${APP} to v${RELEASE}" + + msg_info "Stopping ${APP} Service" + systemctl start ots + msg_ok "Stopped ${APP} Service" + + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi exit }