From 396fbf7eaba9650b9052154eb88f2846e6ddc246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Pastorello?= Date: Thu, 2 Jan 2025 00:48:53 -0300 Subject: [PATCH] Update glpi.sh --- ct/glpi.sh | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/ct/glpi.sh b/ct/glpi.sh index 963534d3..e8e13b3a 100644 --- a/ct/glpi.sh +++ b/ct/glpi.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG -# Author: NĂ­colas Pastorello (opastorello) +# Author: kristocopani # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://semaphoreui.com/ # App Default Values APP="GLPI" @@ -15,18 +16,45 @@ var_os="debian" var_version="12" var_unprivileged="1" +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + function update_script() { header_info check_container_storage check_container_resources - if [[ ! -d /var/www/html/glpi/ ]]; then + + if [[ ! -f /etc/systemd/system/semaphore.service ]]; then msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/') + RELEASE=$(curl -s https://api.github.com/repos/semaphoreui/semaphore/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Service" + systemctl stop semaphore + msg_ok "Stopped Service" + msg_info "Updating ${APP} to v${RELEASE}" - msg_ok "Updated ${APP} LXC" + cd /opt + wget -q https://github.com/semaphoreui/semaphore/releases/download/v${RELEASE}/semaphore_${RELEASE}_linux_amd64.deb + dpkg -i semaphore_${RELEASE}_linux_amd64.deb &>/dev/null + echo "${RELEASE}" >"/opt/${APP}_version.txt" + msg_ok "Updated ${APP} to v${RELEASE}" + + msg_info "Starting Service" + systemctl start semaphore + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -rf /opt/semaphore_${RELEASE}_linux_amd64.deb + msg_ok "Cleaned" + msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at v${RELEASE}." fi