mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-30 20:23:07 +00:00
Refactor: sabnzbd (#4127)
* Refactor: sabnzbd * update SABnzbd to uv * update to uv * Update sabnzbd.sh * Update sabnzbd.sh * Update sabnzbd-install.sh * Update sabnzbd.json * add .sabnzbd/ ini
This commit is contained in:
parent
0356697d5f
commit
c66fb807c8
@ -1,15 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 tteck
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster) | Co-Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://sabnzbd.org/
|
# Source: https://sabnzbd.org/
|
||||||
|
|
||||||
APP="SABnzbd"
|
APP="SABnzbd"
|
||||||
var_tags="${var_tags:-downloader}"
|
var_tags="${var_tags:-downloader}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-4096}"
|
var_ram="${var_ram:-2048}"
|
||||||
var_disk="${var_disk:-8}"
|
var_disk="${var_disk:-5}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
@ -20,30 +20,43 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -d /opt/sabnzbd ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
if [[ ! -d /opt/sabnzbd ]]; then
|
||||||
exit
|
msg_error "No ${APP} Installation Found!"
|
||||||
fi
|
exit
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
fi
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
if [[ -f /opt/${APP}_version.txt ]] && [[ "${RELEASE}" == "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
msg_info "Updating $APP to ${RELEASE}"
|
msg_info "Updating $APP to ${RELEASE}"
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
systemctl stop sabnzbd
|
||||||
systemctl stop sabnzbd.service
|
cp -r /opt/sabnzbd /opt/sabnzbd_backup_$(date +%s)
|
||||||
tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz)
|
temp_file=$(mktemp)
|
||||||
cp -rf SABnzbd-${RELEASE}/* /opt/sabnzbd
|
curl -fsSL "https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz" -o "$temp_file"
|
||||||
rm -rf SABnzbd-${RELEASE}
|
tar -xzf "$temp_file" -C /opt/sabnzbd --strip-components=1
|
||||||
cd /opt/sabnzbd
|
rm -f "$temp_file"
|
||||||
$STD python3 -m pip install -r requirements.txt
|
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"
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
systemctl start sabnzbd.service
|
systemctl start sabnzbd
|
||||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||||
else
|
exit
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
@ -54,3 +67,4 @@ msg_ok "Completed Successfully!\n"
|
|||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7777${CL}"
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7777${CL}"
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 7777,
|
"interface_port": 7777,
|
||||||
"documentation": null,
|
"documentation": "https://sabnzbd.org/wiki/",
|
||||||
"website": "https://sabnzbd.org/",
|
"website": "https://sabnzbd.org/",
|
||||||
"logo": "https://raw.githubusercontent.com/sabnzbd/sabnzbd/develop/icons/logo-arrow.svg",
|
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/sabnzbd.svg",
|
||||||
"config_path": "",
|
"config_path": "/.sabnzbd/sabnzbd.ini",
|
||||||
"description": "SABnzbd is a free, open-source software program for downloading binary files from Usenet newsgroups. It is designed to be easy to use, and provides a number of features to simplify the downloading process, such as automatic error detection and repair, download scheduling, and integration with other applications. SABnzbd is a binary newsreader, which means it is specifically designed for downloading binary files, such as images, music, and video, from Usenet newsgroups. With its user-friendly interface and powerful features, SABnzbd makes it easy to manage your Usenet downloads and keep your download queue organized.",
|
"description": "SABnzbd is a free, open-source software program for downloading binary files from Usenet newsgroups. It is designed to be easy to use, and provides a number of features to simplify the downloading process, such as automatic error detection and repair, download scheduling, and integration with other applications. SABnzbd is a binary newsreader, which means it is specifically designed for downloading binary files, such as images, music, and video, from Usenet newsgroups. With its user-friendly interface and powerful features, SABnzbd makes it easy to manage your Usenet downloads and keep your download queue organized.",
|
||||||
"install_methods": [
|
"install_methods": [
|
||||||
{
|
{
|
||||||
@ -20,8 +20,8 @@
|
|||||||
"script": "ct/sabnzbd.sh",
|
"script": "ct/sabnzbd.sh",
|
||||||
"resources": {
|
"resources": {
|
||||||
"cpu": 2,
|
"cpu": 2,
|
||||||
"ram": 4096,
|
"ram": 2048,
|
||||||
"hdd": 8,
|
"hdd": 5,
|
||||||
"os": "debian",
|
"os": "debian",
|
||||||
"version": "12"
|
"version": "12"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 tteck
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster) | Co-Author: MickLesk (CanbiZ)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# Source: https://sabnzbd.org/
|
# Source: https://sabnzbd.org/
|
||||||
|
|
||||||
@ -14,52 +14,58 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y par2
|
$STD apt-get install -y \
|
||||||
$STD apt-get install -y p7zip-full
|
par2 \
|
||||||
|
p7zip-full
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setup uv"
|
||||||
|
setup_uv
|
||||||
|
msg_ok "Setup uv"
|
||||||
|
|
||||||
|
msg_info "Setup Unrar"
|
||||||
cat <<EOF >/etc/apt/sources.list.d/non-free.list
|
cat <<EOF >/etc/apt/sources.list.d/non-free.list
|
||||||
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
|
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
|
||||||
EOF
|
EOF
|
||||||
$STD apt-get update
|
$STD apt-get update
|
||||||
$STD apt-get install -y unrar
|
$STD apt-get install -y unrar
|
||||||
rm /etc/apt/sources.list.d/non-free.list
|
rm /etc/apt/sources.list.d/non-free.list
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Setup Unrar"
|
||||||
|
|
||||||
msg_info "Setup Python3"
|
|
||||||
$STD apt-get install -y \
|
|
||||||
python3-dev \
|
|
||||||
python3-pip
|
|
||||||
$STD apt-get install -y python3-setuptools
|
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
|
||||||
msg_ok "Setup Python3"
|
|
||||||
|
|
||||||
msg_info "Installing SABnzbd"
|
msg_info "Installing SABnzbd"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
$STD tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz)
|
mkdir -p /opt/sabnzbd
|
||||||
mv SABnzbd-${RELEASE} /opt/sabnzbd
|
$STD uv venv /opt/sabnzbd/venv
|
||||||
cd /opt/sabnzbd
|
temp_file=$(mktemp)
|
||||||
$STD python3 -m pip install -r requirements.txt
|
curl -fsSL "https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz" -o "$temp_file"
|
||||||
|
tar -xzf "$temp_file" -C /opt/sabnzbd --strip-components=1
|
||||||
|
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
|
||||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
msg_ok "Installed SABnzbd"
|
msg_ok "Installed SABnzbd"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
service_path="/etc/systemd/system/sabnzbd.service"
|
cat <<EOF >/etc/systemd/system/sabnzbd.service
|
||||||
echo "[Unit]
|
[Unit]
|
||||||
Description=SABnzbd
|
Description=SABnzbd
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
WorkingDirectory=/opt/sabnzbd
|
WorkingDirectory=/opt/sabnzbd
|
||||||
ExecStart=python3 SABnzbd.py -s 0.0.0.0:7777
|
ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py -s 0.0.0.0:7777
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=root
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target" >$service_path
|
WantedBy=multi-user.target
|
||||||
systemctl enable --now -q sabnzbd.service
|
EOF
|
||||||
|
systemctl enable -q --now sabnzbd
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
rm -f "$temp_file"
|
||||||
$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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user