mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-18 18:54:03 +00:00
par2cmdline-turbo is optional - the install asks <y/N> for it - but its update ran first, unguarded, under catch_errors. When the release lookup failed the ERR trap took the whole run down and SABnzbd itself was never updated: No matching release found for animetosho/par2cmdline-turbo in line 2085: exit code 250 The asset it asks for exists and the release query resolves v1.5.0 against live data, so that lookup failed transiently. Whatever the reason, an optional component must not be able to block the main update. Move it behind the installation check so a missing /opt/sabnzbd is reported first, and warn instead of aborting when the lookup fails. The installed par2 binary simply stays as it is.
76 lines
3.0 KiB
Bash
76 lines
3.0 KiB
Bash
#!/usr/bin/env bash
|
|
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main"
|
|
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
|
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster) | Co-Author: MickLesk (CanbiZ)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://sabnzbd.org/ | Github: https://github.com/sabnzbd/sabnzbd
|
|
|
|
APP="SABnzbd"
|
|
var_tags="${var_tags:-downloader}"
|
|
var_cpu="${var_cpu:-2}"
|
|
var_ram="${var_ram:-2048}"
|
|
var_disk="${var_disk:-5}"
|
|
var_os="${var_os:-debian}"
|
|
var_version="${var_version:-13}"
|
|
var_arm64="${var_arm64:-yes}"
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
function update_script() {
|
|
header_info
|
|
check_container_storage
|
|
check_container_resources
|
|
|
|
if [[ ! -d /opt/sabnzbd ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
if par2 --version 2>/dev/null | grep -q "par2cmdline-turbo"; then
|
|
if ! fetch_and_deploy_gh_release "par2cmdline-turbo" "animetosho/par2cmdline-turbo" "prebuild" "latest" "/usr/bin/" "*-linux-$(arch_resolve).zip"; then
|
|
msg_warn "Could not update par2cmdline-turbo, keeping the installed version"
|
|
fi
|
|
fi
|
|
if check_for_gh_release "sabnzbd-org" "sabnzbd/sabnzbd"; then
|
|
PYTHON_VERSION="3.13" setup_uv
|
|
systemctl stop sabnzbd
|
|
cp -r /opt/sabnzbd /opt/sabnzbd_backup_$(date +%s)
|
|
fetch_and_deploy_gh_release "sabnzbd-org" "sabnzbd/sabnzbd" "prebuild" "latest" "/opt/sabnzbd" "SABnzbd-*-src.tar.gz"
|
|
|
|
# Always ensure venv exists
|
|
if [[ ! -d /opt/sabnzbd/venv ]]; then
|
|
msg_info "Migrating SABnzbd to uv virtual environment"
|
|
$STD uv venv --clear /opt/sabnzbd/venv
|
|
msg_ok "Created uv venv at /opt/sabnzbd/venv"
|
|
fi
|
|
|
|
# Always check and fix service file if needed
|
|
if [[ -f /etc/systemd/system/sabnzbd.service ]] && grep -q "ExecStart=python3 SABnzbd.py" /etc/systemd/system/sabnzbd.service; then
|
|
sed -i "s|ExecStart=python3 SABnzbd.py|ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py|" /etc/systemd/system/sabnzbd.service
|
|
systemctl daemon-reload
|
|
msg_ok "Updated SABnzbd service to use uv venv"
|
|
fi
|
|
$STD uv pip install --upgrade pip --python=/opt/sabnzbd/venv/bin/python
|
|
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
|
|
|
|
systemctl start sabnzbd
|
|
msg_ok "Updated successfully!"
|
|
fi
|
|
exit
|
|
}
|
|
|
|
start
|
|
build_container
|
|
description
|
|
|
|
msg_ok "Completed successfully!\n"
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
|
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
|
echo -e "${GATEWAY}${BGN}http://${IP}:7777${CL}"
|