Update glpi.sh

This commit is contained in:
Nícolas Pastorello 2025-01-02 00:48:53 -03:00 committed by GitHub
parent 0348074c4c
commit 396fbf7eab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,9 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: Nícolas Pastorello (opastorello) # Author: kristocopani
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://semaphoreui.com/
# App Default Values # App Default Values
APP="GLPI" APP="GLPI"
@ -15,18 +16,45 @@ var_os="debian"
var_version="12" var_version="12"
var_unprivileged="1" var_unprivileged="1"
# App Output & Base Settings
header_info "$APP"
base_settings
# Core
variables
color
catch_errors
function update_script() { function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /var/www/html/glpi/ ]]; then
if [[ ! -f /etc/systemd/system/semaphore.service ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi 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 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_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 else
msg_ok "No update required. ${APP} is already at v${RELEASE}." msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi fi