Refactor: Jackett (#6344)

* Refactor

* Update
This commit is contained in:
Slaviša Arežina
2025-07-29 14:52:19 +02:00
committed by GitHub
parent 498723fd62
commit 70cb8198fd
3 changed files with 17 additions and 21 deletions

View File

@@ -27,17 +27,18 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://github.com/Jackett/Jackett/releases/latest | grep "title>Release" | cut -d " " -f 4)
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP}"
curl -fsSL "https://github.com/Jackett/Jackett/releases/download/$RELEASE/Jackett.Binaries.LinuxAMDx64.tar.gz" -o $(basename "https://github.com/Jackett/Jackett/releases/download/$RELEASE/Jackett.Binaries.LinuxAMDx64.tar.gz")
systemctl stop jackett
if [ ! -f /opt/.env ]; then
sed -i 's|^Environment="DisableRootWarning=true"$|EnvironmentFile="/opt/.env"|' /etc/systemd/system/jackett.service
cat <<EOF >/opt/.env
DisableRootWarning=true
EOF
fi
RELEASE=$(curl -s https://api.github.com/repos/Jackett/Jackett/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat ~/.jackett 2>/dev/null)" ]] || [[ ! -f ~/.jackett ]]; then
rm -rf /opt/Jackett
tar -xzf Jackett.Binaries.LinuxAMDx64.tar.gz -C /opt
rm -rf Jackett.Binaries.LinuxAMDx64.tar.gz
systemctl start jackett
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
fetch_and_deploy_gh_release "jackett" "Jackett/Jackett" "prebuild" "latest" "/opt/Jackett" "Jackett.Binaries.LinuxAMDx64.tar.gz"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi