mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-04 12:23:26 +01:00
fix(sabnzbd): update script now migrates old service files to use venv Python (#10466)
- Separates venv creation from service file migration logic - Always checks and fixes service file if it uses system python3 - Fixes installations that have venv but wrong service file path - Ensures all users running update script get automatic migration - Idempotent: safe to run multiple times This applies the same fix from PR #10459 (Bazarr) to SABnzbd, which has the identical bug pattern where service file migration was locked behind a venv existence check. Related: #7332, #10459
This commit is contained in:
committed by
GitHub
parent
e351925119
commit
ded7da536d
@@ -38,16 +38,18 @@ function update_script() {
|
||||
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 /opt/sabnzbd/venv
|
||||
msg_ok "Created uv venv at /opt/sabnzbd/venv"
|
||||
fi
|
||||
|
||||
if 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
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user