11#! /usr/bin/env bash
22source <( curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3- # Copyright (c) 2024 madelyn
3+ # Copyright (c) 2021- 2024 community-scripts ORG
44# Author: madelyn (DysfunctionalProgramming)
55# License: MIT
66# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@@ -17,9 +17,11 @@ cat <<"EOF"
1717EOF
1818}
1919header_info
20+ check_container_storage
21+ check_container_resources
2022echo -e " Loading..."
2123APP=" Komga"
22- var_disk=" 4 "
24+ var_disk=" 2 "
2325var_cpu=" 1"
2426var_ram=" 2048"
2527var_os=" debian"
@@ -54,18 +56,27 @@ function default_settings() {
5456
5557function update_script() {
5658header_info
57- if [[ ! -d /opt/komga ]]; then msg_error " No ${APP} Installation Found!" ; exit ; fi
59+ if [[ ! -f /opt/komga ]]; then msg_error " No ${APP} Installation Found!" ; exit ; fi
5860msg_info " Updating ${APP} "
5961RELEASE=$( curl -s https://api.github.com/repos/gotson/komga/releases/latest | grep " tag_name" | awk ' {print substr($2, 2, length($2)-3) }' )
60- if [[ ! -d /opt/komga/komga-${RELEASE} .jar ]]; then
62+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
63+ msg_info " Stopping ${APP} "
6164 systemctl stop komga
62- msg_info " Downloading ${APP} v$RELEASE "
65+ msg_ok " Stopped ${APP} "
66+
67+ msg_info " Updating ${APP} to $RELEASE "
6368 wget -q " https://github.com/gotson/komga/releases/download/v$RELEASE /komga-${RELEASE} .jar"
64- mkdir -p /opt/komga
65- mv -f komga-${RELEASE} .jar /opt/komga/komga-${RELEASE} .jar
69+ mv -f komga-${RELEASE} .jar /opt/komga/komga.jar
70+ echo " ${RELEASE} " > /opt/${APP} _version.txt
71+ msg_ok " Updated ${APP} to $RELEASE "
72+
73+ msg_info " Starting ${APP} "
6674 systemctl start komga
75+ msg_ok " Started ${APP} "
76+ msg_ok " Updated Successfully"
77+ else
78+ msg_ok " No update required. ${APP} ia already at ${RELEASE} ."
6779fi
68- msg_ok " Updated ${APP} to v$RELEASE "
6980exit
7081}
7182
0 commit comments