Skip to content

Commit

Permalink
Update SABnzbd to 4.2.1 (SynoCommunity#5968)
Browse files Browse the repository at this point in the history
* Update SABnzbd to 4.2.0

* Use SERVICE_WIZARD_SHARENAME

* Update wizards for SHARENAME

- The upgrade wizard identifies an existing share name. If it's not found, an additional screen will appear for user confirmation.

* Adjust wizard SHARENAME check

* Update to 4.2.1

---------

Co-authored-by: mreid-tt <[email protected]>
  • Loading branch information
Safihre and mreid-tt authored Jan 12, 2024
1 parent bad7617 commit b3cf8e0
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 72 deletions.
2 changes: 1 addition & 1 deletion cross/sabnzbd/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = SABnzbd
PKG_VERS = 4.1.0
PKG_VERS = 4.2.1
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS)-src.$(PKG_EXT)
PKG_DIST_SITE = https://github.com/sabnzbd/sabnzbd/releases/download/$(PKG_VERS)
Expand Down
6 changes: 3 additions & 3 deletions cross/sabnzbd/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SABnzbd-4.1.0-src.tar.gz SHA1 7ed45efca18ee589ad24a6fa43ae22a47661aa6e
SABnzbd-4.1.0-src.tar.gz SHA256 24cdc711a9a9425b65b53dd5c084f78cc0f6d978c5c712481b7031751d569588
SABnzbd-4.1.0-src.tar.gz MD5 f1033e949168250aef5500ab919938e6
SABnzbd-4.2.1-src.tar.gz SHA1 642a1d8fbeea42b7f7273675ab5e4f7f1a0d921e
SABnzbd-4.2.1-src.tar.gz SHA256 0d59eefd883774fcb9e3f58a073f4e53467341b34026db08dce506625052ab49
SABnzbd-4.2.1-src.tar.gz MD5 b5489f668a5e528d4176930e9bead006
8 changes: 4 additions & 4 deletions spk/sabnzbd/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = sabnzbd
SPK_VERS = 4.1.0
SPK_REV = 66
SPK_VERS = 4.2.1
SPK_REV = 67
SPK_ICON = src/sabnzbd.png

PYTHON_PACKAGE = python311
Expand All @@ -15,15 +15,15 @@ DESCRIPTION_FRE = SABnzbd rend Usenet aussi simple et automatisé que possible.
DESCRIPTION_SPN = SABnzbd hace que Usenet sea lo más simple posible, automatizando todo lo que se puede. Todo lo que tienes que hacer es agregar un archivo .nzb. SABnzbd empieza desde ahí. Tus archivos serán automáticamente descargados, verificados, reparados, descomprimidos y archivados.
DISPLAY_NAME = SABnzbd
STARTABLE = yes
CHANGELOG = "1. Update SABnzbd to 4.1.0.<br/>2. Use par2cmdline-turbo instead of par2cmdline.<br/>2. Update UnRar to 6.23 (security fixes)."
CHANGELOG = "Update SABnzbd to 4.2.1."

HOMEPAGE = https://sabnzbd.org
LICENSE = GPL

WIZARDS_DIR = src/wizard/

SERVICE_USER = auto
SERVICE_WIZARD_SHARE = wizard_download_dir
SERVICE_WIZARD_SHARENAME = wizard_shared_folder_name
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 8080
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
Expand Down
6 changes: 3 additions & 3 deletions spk/sabnzbd/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# cross-compiled wheels
cffi==1.15.1
cffi==1.16.0
Cheetah3==3.2.6
sabctools==7.1.2
orjson==3.9.7
sabctools==8.1.0
orjson==3.9.10
10 changes: 5 additions & 5 deletions spk/sabnzbd/src/requirements-pure.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Wheels that absolutely needs
# to be managed as pure-python
feedparser==6.0.10
feedparser==6.0.11
configobj==5.0.8
cheroot==10.0.0
cherrypy==18.8.0
jaraco.functools==3.9.0
jaraco.collections==4.3.0
cherrypy==18.9.0
jaraco.functools==4.0.0
jaraco.collections==5.0.0
jaraco.text==3.8.1 # Newer version introduces irrelevant extra dependencies
jaraco.classes==3.3.0
jaraco.context==4.3.0
Expand All @@ -19,6 +19,6 @@ portend==3.2.0
chardet==5.2.0
PySocks==1.7.1
puremagic==1.15
guessit==3.7.1
guessit==3.8.0
babelfish==0.6.0
rebulk==3.2.0
9 changes: 4 additions & 5 deletions spk/sabnzbd/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ service_postinst ()

if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
# Edit the configuration according to the wizard
shared_folder="${wizard_volume:=/volume1}/${wizard_download_dir:=downloads}"
sed -i -e "s|@shared_folder@|${shared_folder}|g" ${CFG_FILE}
sed -i -e "s|@shared_folder@|${SHARE_PATH}|g" ${CFG_FILE}
sed -i -e "s|@script_dir@|${SYNOPKG_PKGVAR}/scripts|g" ${CFG_FILE}

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then
Expand All @@ -33,9 +32,9 @@ service_postinst ()
else
# DSM6: Create folders with right permissions
# DSM7: Let SABnzbd create them on first start
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${shared_folder}/incomplete"
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${shared_folder}/complete"
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${shared_folder}/watch"
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${SHARE_PATH}/incomplete"
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${SHARE_PATH}/complete"
install -m 0775 -o ${EFF_USER} -g ${GROUP} -d "${SHARE_PATH}/watch"

# Create logs directory, otherwise it does not start due to permissions errors
mkdir -p "$(dirname ${LOG_FILE})"
Expand Down
57 changes: 12 additions & 45 deletions spk/sabnzbd/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -1,48 +1,15 @@
[
{
"step_title": "Basic configuration",
"step_title": "Basic Configuration",
"items": [
{
"type": "combobox",
"desc": "Please select a volume to use for the download folder",
"subitems": [
{
"key": "wizard_volume",
"desc": "volume name",
"displayField": "display_name",
"valueField": "volume_path",
"editable": false,
"mode": "remote",
"api_store": {
"api": "SYNO.Core.Storage.Volume",
"method": "list",
"version": 1,
"baseParams": {
"limit": -1,
"offset": 0,
"location": "internal"
},
"root": "volumes",
"idProperty": "volume_path",
"fields": [
"display_name",
"volume_path"
]
},
"validator": {
"fn": "{console.log(arguments);return true;}"
}
}
]
},
{
"type": "textfield",
"desc": "Download shared folder (using the volume chosen above)",
"desc": "Please specify a download folder for this package. This share is created at installation when it does not already exist.",
"subitems": [
{
"key": "wizard_download_dir",
"desc": "Download location",
"defaultValue": "downloads",
"key": "wizard_shared_folder_name",
"desc": "Shared Folder",
"defaultValue": "Downloads",
"validator": {
"allowBlank": false,
"regex": {
Expand All @@ -52,13 +19,13 @@
}
}
]
},
{
"desc": "If the specified share does not exist, it will be created. You can use an existing share by specifying the name of the folder."
},
{
"desc": "Package user and group will not appear on most UI settings.<br>Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
}, {
"desc": "If you let the installer handle it, the shared folder goes to the package's volume. To use a different volume, create the shared folder in DSM Control Panel before installation and input its name during setup."
}, {
"desc": ""
}, {
"desc": "This package utilizes the internal service user <b>'sc-sabnzbd'</b> in DSM. The shared folder mentioned is set up during installation to be accessible specifically by this user. For more detailed information, please consult the <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> guide."
}
]
}
]
]
6 changes: 0 additions & 6 deletions spk/sabnzbd/src/wizard/upgrade_uifile

This file was deleted.

97 changes: 97 additions & 0 deletions spk/sabnzbd/src/wizard/upgrade_uifile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

page_append ()
{
if [ -z "$1" ]; then
echo "$2"
elif [ -z "$2" ]; then
echo "$1"
else
echo "$1,$2"
fi
}

CFG_FILE="/var/packages/${SYNOPKG_PKGNAME}/var/config.ini"
# Extract share path and name from application config
CONFIGURED_SHARE_PATH=$(awk -F' = ' '/^download_dir/{split($2, path, "/"); print "/" path[2] "/" path[3]}' "${CFG_FILE}")
CONFIGURED_SHARE_NAME=$(echo "${CONFIGURED_SHARE_PATH}" | awk -F'/' '{print $NF}')

VAR_FILE="/var/packages/${SYNOPKG_PKGNAME}/etc/installer-variables"
# Extract share path from installer variables or configured shares
PACKAGE_SHARE_PATH=$(awk -F'=' '/^SHARE_PATH=/{print $2}' "${VAR_FILE}" 2>/dev/null || echo "")
if [ -z "$PACKAGE_SHARE_PATH" ] && [ -d "/var/packages/${SYNOPKG_PKGNAME}/shares" ]; then
PACKAGE_SHARE_PATH=$(realpath "/var/packages/${SYNOPKG_PKGNAME}/shares/${CONFIGURED_SHARE_NAME}" 2>/dev/null || echo "")
fi
# Extract share name from installer variables or configured shares
PACKAGE_SHARE_NAME=$(awk -F'=' '/^SHARE_NAME=/{print $2}' "${VAR_FILE}" 2>/dev/null || echo "")
if [ -z "$PACKAGE_SHARE_NAME" ] && [ -d "/var/packages/${SYNOPKG_PKGNAME}/shares/${CONFIGURED_SHARE_NAME}" ]; then
PACKAGE_SHARE_NAME=${CONFIGURED_SHARE_NAME}
fi

# Check for data share
check_data_share ()
{
if [ -n "${PACKAGE_SHARE_NAME}" ]; then
return 0 # true
elif [ -n "$CONFIGURED_SHARE_PATH" ] && [ -n "$PACKAGE_SHARE_PATH" ] && [ "$CONFIGURED_SHARE_PATH" = "$PACKAGE_SHARE_PATH" ]; then
# If consistent data share path, assume share name is correct
return 0 # true
else
return 1 # false
fi
}

PAGE_SHARE_UPGRADE=$(/bin/cat<<EOF
{
"step_title": "Shared Folder Upgrade",
"invalid_next_disabled_v2": true,
"items": [{
"type": "textfield",
"desc": "The download folder for this package must now be located within a data share. As per the existing configuration, the identified data share for your downloads is:",
"subitems": [{
"key": "wizard_shared_folder_name",
"desc": "Shared Folder",
"defaultValue": "${CONFIGURED_SHARE_NAME}",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\\w _-]+$/",
"errorText": "Subdirectories are not supported."
}
}
}]
},{
"desc": "IMPORTANT: If your download folder is not currently located in the specified share, a new share will be created. After the upgrade, you may need to manually update your configuration to reflect this new location."
}]
}
EOF
)

PAGE_DSM_PERMISSIONS=$(/bin/cat<<EOF
{
"step_title": "DSM Permissions",
"items": [{
"desc": "Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
},{
"type": "textfield",
"subitems": [{
"key": "wizard_shared_folder_name",
"defaultValue": "${CONFIGURED_SHARE_NAME}",
"hidden": true
}]
}]
}
EOF
)

main () {
local upgrade_page=""
if ! check_data_share; then
upgrade_page=$(page_append "$upgrade_page" "$PAGE_SHARE_UPGRADE")
else
upgrade_page=$(page_append "$upgrade_page" "$PAGE_DSM_PERMISSIONS")
fi
echo "[$upgrade_page]" > "${SYNOPKG_TEMP_LOGFILE}"
}

main "$@"

0 comments on commit b3cf8e0

Please sign in to comment.