From 52bfc1725f3efa9c056dd0d23c7e950ba9a5e7e5 Mon Sep 17 00:00:00 2001 From: tteckster Date: Mon, 19 Aug 2024 07:56:39 -0400 Subject: [PATCH] Update commafeed.sh refactor --- ct/commafeed.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ct/commafeed.sh b/ct/commafeed.sh index c5eeecad..eb62d0a0 100644 --- a/ct/commafeed.sh +++ b/ct/commafeed.sh @@ -55,19 +55,27 @@ function default_settings() { function update_script() { header_info if [[ ! -d /opt/commafeed ]]; then msg_error "No ${APP} Installation Found!"; exit; fi -msg_info "Stopping CommaFeed" -systemctl stop commafeed -msg_ok "Stopped CommaFeed" +RELEASE=$(curl -sL https://api.github.com/repos/Athou/commafeed/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping ${APP}" + systemctl stop commafeed + msg_ok "Stopped ${APP}" -msg_info "Updating CommaFeed" -cd /opt/commafeed -rm commafeed.jar -wget -q https://github.com/Athou/commafeed/releases/latest/download/commafeed.jar -msg_ok "Updated CommaFeed" + msg_info "Updating ${APP} to ${RELEASE}" + wget https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip + unzip -q commafeed-${RELEASE}-h2-jvm.zip + rsync -a --exclude 'data/' commafeed-${RELEASE}-h2/ /opt/commafeed/ + rm -rf commafeed-${RELEASE}-h2-jvm.zip + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" -msg_info "Starting CommaFeed" -systemctl start commafeed -msg_ok "Update Completed Successfully" + msg_info "Starting ${APP}" + systemctl start commafeed + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi exit }