Refactor: Commafeed (#5802)

This commit is contained in:
Slaviša Arežina
2025-07-09 14:22:41 +02:00
committed by GitHub
parent 54cd7dd669
commit 8c09216691
2 changed files with 12 additions and 24 deletions

View File

@ -23,12 +23,13 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/commafeed ]]; then if [[ ! -d /opt/commafeed ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/Athou/commafeed/releases/latest | grep '"tag_name":' | cut -d'"' -f4) RELEASE=$(curl -fsSL 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 if [[ "${RELEASE}" != "$(cat ~/.commafeed 2>/dev/null)" ]] || [[ ! -f ~/.commafeed ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop commafeed systemctl stop commafeed
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
@ -39,13 +40,15 @@ function update_script() {
$STD apt-get install -y rsync $STD apt-get install -y rsync
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
fi fi
if [ -d /opt/commafeed/data ] && [ "$(ls -A /opt/commafeed/data)" ]; then
mv /opt/commafeed/data /opt/data.bak
fi
fetch_and_deploy_gh_release "commafeed" "Athou/commafeed" "prebuild" "latest" "/opt/commafeed" "commafeed-*-h2-jvm.zip"
msg_info "Updating ${APP} to ${RELEASE}" msg_info "Updating ${APP} to ${RELEASE}"
curl -fsSL "https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip" -o $(basename "https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip") if [ -d /opt/commafeed/data.bak ] && [ "$(ls -A /opt/commafeed/data.bak)" ]; then
$STD unzip commafeed-"${RELEASE}"-h2-jvm.zip mv /opt/commafeed/data.bak /opt/commafeed/data
rsync -a --exclude 'data/' commafeed-"${RELEASE}"-h2/ /opt/commafeed/ fi
rm -rf commafeed-"${RELEASE}"-h2 commafeed-"${RELEASE}"-h2-jvm.zip
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}" msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP}" msg_info "Starting ${APP}"

View File

@ -17,22 +17,8 @@ msg_info "Installing Dependencies"
$STD apt-get install -y rsync $STD apt-get install -y rsync
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Azul Zulu" JAVA_VERSION="17" setup_java
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" -o "/etc/apt/trusted.gpg.d/zulu-repo.asc" fetch_and_deploy_gh_release "commafeed" "Athou/commafeed" "prebuild" "latest" "/opt/commafeed" "commafeed-*-h2-jvm.zip"
curl -fsSL "https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb" -o "zulu-repo_1.0.0-3_all.deb"
$STD dpkg -i zulu-repo_1.0.0-3_all.deb
$STD apt-get update
$STD apt-get -y install zulu17-jdk
msg_ok "Installed Azul Zulu"
RELEASE=$(curl -fsSL https://api.github.com/repos/Athou/commafeed/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
msg_info "Installing CommaFeed ${RELEASE}"
mkdir /opt/commafeed
curl -fsSL "https://github.com/Athou/commafeed/releases/download/${RELEASE}/commafeed-${RELEASE}-h2-jvm.zip" -o "commafeed-${RELEASE}-h2-jvm.zip"
$STD unzip commafeed-${RELEASE}-h2-jvm.zip
mv commafeed-${RELEASE}-h2/* /opt/commafeed/
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed CommaFeed ${RELEASE}"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/commafeed.service cat <<EOF >/etc/systemd/system/commafeed.service
@ -55,7 +41,6 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf commafeed-${RELEASE}-h2 commafeed-${RELEASE}-h2-jvm.zip zulu-repo_1.0.0-3_all.deb
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"