Skip to content

Commit c84c448

Browse files
burgergaMickLesk
andauthored
Update SABnzbd. Include par2cmdline-turbo (#8648)
* Fix non-free sources - Don't delete after use - Use trixie instead of bookworm - deb822 style * Add par2cmdline-turbo to sabnzbd * Remove duplicate setup_uv * Remove duplicated msg around setup_uv * Update sabnzbd to use fetch_and_deploy * switch fetch_deploy outside of msg Added virtual environment setup and package installation for SABnzbd. --------- Co-authored-by: CanbiZ <[email protected]>
1 parent f77c259 commit c84c448

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

ct/sabnzbd.sh

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,38 @@ function update_script() {
2424
check_container_storage
2525
check_container_resources
2626

27+
if par2 --version | grep -q "par2cmdline-turbo"; then
28+
fetch_and_deploy_gh_release "par2cmdline-turbo" "animetosho/par2cmdline-turbo" "prebuild" "latest" "/usr/bin/" "*-linux-amd64.zip"
29+
fi
30+
2731
if [[ ! -d /opt/sabnzbd ]]; then
2832
msg_error "No ${APP} Installation Found!"
2933
exit
3034
fi
31-
setup_uv
32-
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33-
if [[ -f /opt/${APP}_version.txt ]] && [[ "${RELEASE}" == "$(cat /opt/${APP}_version.txt)" ]]; then
34-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
35-
exit
36-
fi
37-
setup_uv
38-
msg_info "Updating $APP to ${RELEASE}"
39-
systemctl stop sabnzbd
40-
cp -r /opt/sabnzbd /opt/sabnzbd_backup_$(date +%s)
41-
temp_file=$(mktemp)
42-
curl -fsSL "https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz" -o "$temp_file"
43-
tar -xzf "$temp_file" -C /opt/sabnzbd --strip-components=1
44-
rm -f "$temp_file"
45-
if [[ ! -d /opt/sabnzbd/venv ]]; then
46-
msg_info "Migrating SABnzbd to uv virtual environment"
47-
$STD uv venv /opt/sabnzbd/venv
48-
msg_ok "Created uv venv at /opt/sabnzbd/venv"
35+
if check_for_gh_release "sabnzbd-org" "sabnzbd/sabnzbd"; then
36+
PYTHON_VERSION="3.13" setup_uv
37+
systemctl stop sabnzbd
38+
cp -r /opt/sabnzbd /opt/sabnzbd_backup_$(date +%s)
39+
fetch_and_deploy_gh_release "sabnzbd-org" "sabnzbd/sabnzbd" "prebuild" "latest" "/opt/sabnzbd" "SABnzbd-*-src.tar.gz"
4940

50-
if grep -q "ExecStart=python3 SABnzbd.py" /etc/systemd/system/sabnzbd.service; then
51-
sed -i "s|ExecStart=python3 SABnzbd.py|ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py|" /etc/systemd/system/sabnzbd.service
52-
systemctl daemon-reload
53-
msg_ok "Updated SABnzbd service to use uv venv"
41+
42+
if [[ ! -d /opt/sabnzbd/venv ]]; then
43+
msg_info "Migrating SABnzbd to uv virtual environment"
44+
$STD uv venv /opt/sabnzbd/venv
45+
msg_ok "Created uv venv at /opt/sabnzbd/venv"
46+
47+
if grep -q "ExecStart=python3 SABnzbd.py" /etc/systemd/system/sabnzbd.service; then
48+
sed -i "s|ExecStart=python3 SABnzbd.py|ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py|" /etc/systemd/system/sabnzbd.service
49+
systemctl daemon-reload
50+
msg_ok "Updated SABnzbd service to use uv venv"
51+
fi
5452
fi
53+
$STD uv pip install --upgrade pip --python=/opt/sabnzbd/venv/bin/python
54+
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
55+
56+
systemctl start sabnzbd
57+
msg_ok "Updated Successfully"
5558
fi
56-
$STD uv pip install --upgrade pip --python=/opt/sabnzbd/venv/bin/python
57-
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
58-
echo "${RELEASE}" >/opt/${APP}_version.txt
59-
systemctl start sabnzbd
60-
msg_ok "Updated ${APP} to ${RELEASE}"
6159
exit
6260
}
6361

install/sabnzbd-install.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,33 @@ $STD apt install -y \
1919
p7zip-full
2020
msg_ok "Installed Dependencies"
2121

22-
msg_info "Setup uv"
23-
setup_uv
24-
msg_ok "Setup uv"
22+
PYTHON_VERSION="3.13" setup_uv
2523

2624
msg_info "Setup Unrar"
27-
cat <<EOF >/etc/apt/sources.list.d/non-free.list
28-
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
25+
cat <<EOF >/etc/apt/sources.list.d/non-free.sources
26+
Types: deb
27+
URIs: http://deb.debian.org/debian/
28+
Suites: trixie
29+
Components: non-free
30+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
2931
EOF
3032
$STD apt update
3133
$STD apt install -y unrar
32-
rm /etc/apt/sources.list.d/non-free.list
3334
msg_ok "Setup Unrar"
3435

36+
fetch_and_deploy_gh_release "sabnzbd-org" "sabnzbd/sabnzbd" "prebuild" "latest" "/opt/sabnzbd" "SABnzbd-*-src.tar.gz"
37+
3538
msg_info "Installing SABnzbd"
36-
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
37-
mkdir -p /opt/sabnzbd
3839
$STD uv venv /opt/sabnzbd/venv
39-
temp_file=$(mktemp)
40-
curl -fsSL "https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz" -o "$temp_file"
41-
tar -xzf "$temp_file" -C /opt/sabnzbd --strip-components=1
4240
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
43-
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
4441
msg_ok "Installed SABnzbd"
4542

43+
read -r -p "Would you like to install par2cmdline-turbo? <y/N> " prompt
44+
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
45+
mv /usr/bin/par2 /usr/bin/par2.old
46+
fetch_and_deploy_gh_release "par2cmdline-turbo" "animetosho/par2cmdline-turbo" "prebuild" "latest" "/usr/bin/" "*-linux-amd64.zip"
47+
fi
48+
4649
msg_info "Creating Service"
4750
cat <<EOF >/etc/systemd/system/sabnzbd.service
4851
[Unit]
@@ -65,7 +68,6 @@ motd_ssh
6568
customize
6669

6770
msg_info "Cleaning up"
68-
rm -f "$temp_file"
6971
$STD apt -y autoremove
7072
$STD apt -y autoclean
7173
$STD apt -y clean

0 commit comments

Comments
 (0)