Update ots.sh

This commit is contained in:
Bas van den Berg 2025-07-20 15:40:27 +02:00 committed by GitHub
parent af1c0726cb
commit 34113208ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}