Refactor (#6374)
This commit is contained in:
parent
234b4e334e
commit
f33c292c3e
14
ct/komga.sh
14
ct/komga.sh
@ -27,23 +27,21 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
msg_info "Updating ${APP}"
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/gotson/komga/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/gotson/komga/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
|
if [[ ! -f ~/.komga ]] || [[ "${RELEASE}" != "$(cat ~/.komga)" ]]; then
|
||||||
msg_info "Stopping ${APP}"
|
msg_info "Stopping ${APP}"
|
||||||
systemctl stop komga
|
systemctl stop komga
|
||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
rm -f /opt/komga/komga.jar
|
||||||
curl -fsSL "https://github.com/gotson/komga/releases/download/${RELEASE}/komga-${RELEASE}.jar" -o $(basename "https://github.com/gotson/komga/releases/download/${RELEASE}/komga-${RELEASE}.jar")
|
USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "komga" "gotson/komga" "singlefile" "latest" "/opt/komga" "komga*.jar"
|
||||||
rm -rf /opt/komga/komga.jar
|
mv /opt/komga/komga-*.jar /opt/komga/komga.jar
|
||||||
mv -f komga-${RELEASE}.jar /opt/komga/komga.jar
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
systemctl start komga
|
systemctl start komga
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}."
|
msg_ok "No update required. ${APP} is already at ${RELEASE}."
|
||||||
|
@ -13,17 +13,9 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
JAVA_VERSION="21" setup_java
|
||||||
$STD apt-get install -y openjdk-17-jre
|
USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "komga" "gotson/komga" "singlefile" "latest" "/opt/komga" "komga*.jar"
|
||||||
msg_ok "Installed Dependencies"
|
mv /opt/komga/komga-*.jar /opt/komga/komga.jar
|
||||||
|
|
||||||
msg_info "Installing Komga"
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/gotson/komga/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
|
||||||
curl -fsSL "https://github.com/gotson/komga/releases/download/${RELEASE}/komga-${RELEASE}.jar" -o "komga-${RELEASE}.jar"
|
|
||||||
mkdir -p /opt/komga
|
|
||||||
mv -f komga-${RELEASE}.jar /opt/komga/komga.jar
|
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
|
||||||
msg_ok "Installed Komga"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/komga.service
|
cat <<EOF >/etc/systemd/system/komga.service
|
||||||
@ -42,7 +34,7 @@ Restart=on-failure
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable --now -q komga
|
systemctl enable -q --now komga
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user