Skip to content

Commit e1b9a9e

Browse files
authored
Address PR feedback to bring more in line with other scripts
1 parent 21b5b00 commit e1b9a9e

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

ct/komga.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
source <(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"
1717
EOF
1818
}
1919
header_info
20+
check_container_storage
21+
check_container_resources
2022
echo -e "Loading..."
2123
APP="Komga"
22-
var_disk="4"
24+
var_disk="2"
2325
var_cpu="1"
2426
var_ram="2048"
2527
var_os="debian"
@@ -54,18 +56,27 @@ function default_settings() {
5456

5557
function update_script() {
5658
header_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
5860
msg_info "Updating ${APP}"
5961
RELEASE=$(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}."
6779
fi
68-
msg_ok "Updated ${APP} to v$RELEASE"
6980
exit
7081
}
7182

install/komga-install.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

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
@@ -14,35 +14,35 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt-get install -y curl
18-
$STD apt-get install -y openjdk-17-jre
17+
$STD apt-get install -y curl mc sudo openjdk-17-jre
1918
msg_ok "Installed Dependencies"
2019

2120
RELEASE=$(curl -s https://api.github.com/repos/gotson/komga/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
2221

2322
msg_info "Installing Komga"
2423
wget -q https://github.com/gotson/komga/releases/download/${RELEASE}/komga-${RELEASE}.jar
2524
mkdir -p /opt/komga
26-
mv -f komga-${RELEASE}.jar /opt/komga/komga-${RELEASE}.jar
27-
msg_ok "Installed Komga 😊"
25+
mv -f komga-${RELEASE}.jar /opt/komga/komga.jar
26+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
27+
msg_ok "Installed Komga"
2828

2929
msg_info "Creating Service"
30-
service_path="/etc/systemd/system/komga.service"
31-
32-
echo "[Unit]
30+
cat <<EOF >/etc/systemd/system/komga.service
31+
[Unit]
3332
Description=Komga
3433
After=syslog.target network.target
35-
3634
[Service]
37-
User=root
35+
UMask=0002
3836
Type=simple
39-
ExecStart=java -jar -Xmx2g komga-${RELEASE}.jar
4037
WorkingDirectory=/opt/komga/
38+
ExecStart=java -jar -Xmx2g komga.jar
4139
TimeoutStopSec=20
42-
Restart=always
43-
40+
KillMode=process
41+
Restart=on-failure
4442
[Install]
45-
WantedBy=multi-user.target" >$service_path
43+
WantedBy=multi-user.target
44+
EOF
45+
systemctl -q daemon-reload
4646
systemctl enable --now -q komga
4747
msg_ok "Created Service"
4848

0 commit comments

Comments
 (0)