Update commafeed.sh

refactor
This commit is contained in:
tteckster 2024-08-19 07:56:39 -04:00 committed by GitHub
parent 0a33d1739e
commit 52bfc1725f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,19 +55,27 @@ function default_settings() {
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/commafeed ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/commafeed ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Stopping CommaFeed" RELEASE=$(curl -sL https://api.github.com/repos/Athou/commafeed/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
systemctl stop commafeed if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_ok "Stopped CommaFeed" msg_info "Stopping ${APP}"
systemctl stop commafeed
msg_ok "Stopped ${APP}"
msg_info "Updating CommaFeed" msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/commafeed wget https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip
rm commafeed.jar unzip -q commafeed-${RELEASE}-h2-jvm.zip
wget -q https://github.com/Athou/commafeed/releases/latest/download/commafeed.jar rsync -a --exclude 'data/' commafeed-${RELEASE}-h2/ /opt/commafeed/
msg_ok "Updated CommaFeed" rm -rf commafeed-${RELEASE}-h2-jvm.zip
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting CommaFeed" msg_info "Starting ${APP}"
systemctl start commafeed systemctl start commafeed
msg_ok "Update Completed Successfully" msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
} }