From 9bf42a082c62a8a71d531bae5b4e2f3728d2e246 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Mon, 9 Jun 2025 10:13:17 +0200 Subject: [PATCH] Add update function to Kapowarr --- ct/kapowarr.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ct/kapowarr.sh b/ct/kapowarr.sh index bb58341f..28f8c846 100644 --- a/ct/kapowarr.sh +++ b/ct/kapowarr.sh @@ -23,11 +23,33 @@ function update_script() { header_info check_container_storage check_container_resources + if [[ ! -f /etc/systemd/system/kapowarr.service ]]; then msg_error "No ${APP} Installation Found!" exit fi - msg_error "No Update." + RELEASE=$(curl -s https://api.github.com/repos/Casvt/Kapowarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat $HOME/.kapowarr)" ]] || [[ ! -f $HOME/.kapowarr ]]; then + msg_info "Stopping $APP" + systemctl stop kapowarr + msg_ok "Stopped $APP" + + msg_info "Creating Backup" + mv /opt/kapowarr/db /opt/ + msg_ok "Backup Created" + + msg_info "Updating $APP to ${RELEASE}" + fetch_and_deploy_gh_release "kapowarr" "Casvt/Kapowarr" + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start kapowarr + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi exit }