Update glpi.sh

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

View File

@ -30,30 +30,18 @@ function update_script() {
check_container_storage
check_container_resources
if [[ ! -f /etc/systemd/system/semaphore.service ]]; then
if [[ ! -d /var/www/html/glpi/ ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/semaphoreui/semaphore/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
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}"
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}."