Skip to content

Commit a1aa165

Browse files
authored
NZBget: update package for DSM 7 (#4996)
1 parent 8e49a9f commit a1aa165

File tree

6 files changed

+189
-122
lines changed

6 files changed

+189
-122
lines changed

spk/nzbget/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SPK_NAME = nzbget
22
SPK_VERS = $(shell date +%Y%m%d)
3-
SPK_REV = 27
3+
SPK_REV = 28
44
SPK_ICON = src/nzbget.png
55

66
DEPENDS = cross/p7zip cross/unrar
@@ -11,18 +11,19 @@ DESCRIPTION_FRE = NZBGet est un récupérateur de news en ligne de commande écr
1111
DESCRIPTION_SPN = NZBGet es una aplicación de linea de comandos escrita en C++ para descargar binarios, desde servidores de noticias, utilizando archivos nzb. Soporta modo cliente y servidor, verificación y descompresión automática y una interfaz web. NZBGet utiliza pocos recursos de sistema.
1212
STARTABLE = yes
1313
DISPLAY_NAME = NZBGet
14-
CHANGELOG = "1. Remove DSM5 -> DSM6 migration.<br/>2. Support for DS-x20 models."
14+
CHANGELOG = "Update for DSM 7 and DSM 7 compatible shared folders."
1515

1616
HOMEPAGE = https://nzbget.net
1717
LICENSE = GPLv2
1818

19-
WIZARDS_DIR = src/wizard/
19+
WIZARDS_DIR = src/wizard
2020

2121
SERVICE_USER = auto
22-
SERVICE_WIZARD_SHARE = wizard_download_dir
22+
SERVICE_WIZARD_SHARE = wizard_download_folder
23+
USE_DATA_SHARE_WORKER = yes
2324
SERVICE_SETUP = src/service-setup.sh
2425
SERVICE_PORT = 6789
25-
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
26+
SERVICE_PORT_TITLE = NZBGet (HTTP)
2627

2728
# Admin link for in DSM UI
2829
ADMIN_PORT = $(SERVICE_PORT)

spk/nzbget/src/service-setup.sh

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
PATH="${SYNOPKG_PKGDEST}/bin:${PATH}"
23
NZBGET="${SYNOPKG_PKGDEST}/bin/nzbget"
34
CFG_FILE="${SYNOPKG_PKGVAR}/nzbget.conf"
@@ -12,7 +13,7 @@ SERVICE_COMMAND="${NZBGET} -c ${CFG_FILE} -o WebDir=${WEBDIR} -o LockFile=${PID_
1213

1314
service_postinst ()
1415
{
15-
# Download latest NZBGet
16+
# Download current NZBGet (stable or testing)
1617
if [ -n "${wizard_stable_release}" ] && [ "${wizard_stable_release}" = true ]; then
1718
echo "Download nzbget installer: latest"
1819
wget --quiet --output-document="${NZBGET_INSTALLER}" "https://nzbget.net/download/nzbget-latest-bin-linux.run"
@@ -22,23 +23,20 @@ service_postinst ()
2223
wget --quiet --output-document="${NZBGET_INSTALLER}" "https://nzbget.net/download/nzbget-latest-testing-bin-linux.run"
2324
fi
2425

25-
# Stop if download failed
26+
# Abort if download failed
2627
if [ ! -r "${NZBGET_INSTALLER}" ]; then
2728
echo "Failed to download installer, please check the internet connection of your device."
2829
exit 1
2930
fi
3031
echo "Download completed"
3132

32-
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then
33-
# On DSM5 the lib-dir is not owned by the package-user
34-
set_unix_permissions "${SYNOPKG_PKGDEST}/bin"
33+
chmod +x "${NZBGET_INSTALLER}"
34+
${NZBGET_INSTALLER} --destdir ${SYNOPKG_PKGDEST}/bin
3535

36-
# Install as nzbget user, for correct permissions
37-
chmod +x "${NZBGET_INSTALLER}"
38-
su ${EFF_USER} -s /bin/sh -c "${NZBGET_INSTALLER} --destdir ${SYNOPKG_PKGDEST}/bin"
39-
else
40-
chmod +x "${NZBGET_INSTALLER}"
41-
${NZBGET_INSTALLER} --destdir ${SYNOPKG_PKGDEST}/bin
36+
if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 7 ]; then
37+
# On DSM 5 and 6 the nzbget archive is extracted with the internal build owner (id 1001).
38+
# Overwrite with the package owner
39+
set_unix_permissions "${SYNOPKG_PKGDEST}/bin"
4240
fi
4341

4442
# Make sure installation worked
@@ -48,30 +46,30 @@ service_postinst ()
4846
exit 1
4947
fi
5048

51-
# Copy the new template config file created by installer
49+
# Make a copy of the config file created by the current installer
5250
cp -f ${SYNOPKG_PKGDEST}/bin/nzbget.conf ${TEMPLATE_CFG_FILE}
5351

5452
# Remove installer
5553
rm -f "${NZBGET_INSTALLER}"
5654

57-
# Create config file if not exists
55+
# Create the config file on demand
5856
if [ ! -e "${CFG_FILE}" ]; then
59-
echo "create config file"
57+
echo "Create initial config file"
6058

6159
# Use whatever the installer found best
6260
# It does optimizations based on the current system
6361
cp -f ${TEMPLATE_CFG_FILE} ${CFG_FILE}
6462

6563
# Edit the configuration according to the wizard
66-
sed -i -e "s|MainDir=.*$|MainDir=${wizard_download_dir:=/volume1/downloads}|g" \
67-
-e "s/ControlUsername=.*$/ControlUsername=${wizard_control_username:=nzbget}/g" \
68-
-e "s/ControlPassword=.*$/ControlPassword=${wizard_control_password:=nzbget}/g" \
69-
${CFG_FILE}
64+
sed -e "s|MainDir=.*$|MainDir=${wizard_download_volume}/${wizard_download_folder}|g" \
65+
-e "s/ControlUsername=.*$/ControlUsername=${wizard_control_username:=nzbget}/g" \
66+
-e "s/ControlPassword=.*$/ControlPassword=${wizard_control_password:=nzbget}/g" \
67+
-i ${CFG_FILE}
7068

7169
# Update to match our paths
72-
sed -i -e "s|ScriptDir=.*$|ScriptDir=${SYNOPKG_PKGDEST}/share/nzbget/scripts|g" \
73-
-e "s|LogFile=.*$|LogFile=${SYNOPKG_PKGDEST}/var/nzbget.log|g" \
74-
-e "s|ConfigTemplate=.*$|ConfigTemplate=${TEMPLATE_CFG_FILE}|g" \
75-
${CFG_FILE}
70+
sed -e "s|ScriptDir=.*$|ScriptDir=${SYNOPKG_PKGDEST}/share/nzbget/scripts|g" \
71+
-e "s|LogFile=.*$|LogFile=${SYNOPKG_PKGVAR}/nzbget.log|g" \
72+
-e "s|ConfigTemplate=.*$|ConfigTemplate=${TEMPLATE_CFG_FILE}|g" \
73+
-i ${CFG_FILE}
7674
fi
7775
}

spk/nzbget/src/wizard/install_uifile

Lines changed: 76 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,106 @@
11
[{
2-
"step_title": "Basic configuration",
2+
"step_title": "Shared folder configuration",
33
"items": [{
4+
"desc": "Shared folder of downloaded files. If the specified share does not exist, it will be created."
5+
}, {
6+
"type": "combobox",
7+
"desc": "Please select a volume and a folder to use for the download files",
8+
"subitems": [{
9+
"key": "wizard_download_volume",
10+
"desc": "Volume name",
11+
"displayField": "display_name",
12+
"valueField": "volume_path",
13+
"editable": false,
14+
"mode": "remote",
15+
"api_store": {
16+
"api": "SYNO.Core.Storage.Volume",
17+
"method": "list",
18+
"version": 1,
19+
"baseParams": {
20+
"limit": -1,
21+
"offset": 0,
22+
"location": "internal"
23+
},
24+
"root": "volumes",
25+
"idProperty": "volume_path",
26+
"fields": [
27+
"display_name",
28+
"volume_path"
29+
]
30+
},
31+
"validator": {
32+
"fn": "{console.log(arguments);return true;}"
33+
}
34+
}
35+
]
36+
}, {
437
"type": "textfield",
5-
"desc": "Download location",
38+
"desc": "Specify the name of the shared folder.",
639
"subitems": [{
7-
"key": "wizard_download_dir",
40+
"key": "wizard_download_folder",
841
"desc": "Download directory",
9-
"defaultValue": "/volume1/downloads",
42+
"defaultValue": "downloads",
1043
"validator": {
11-
"allowBlank": false,
12-
"regex": {
13-
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
14-
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
15-
}
44+
"allowBlank": false,
45+
"regex": {
46+
"expr": "/^[^<>: */?\"]*/",
47+
"errorText": "Share name must be a folder name only. Path separators, spaces and other special chars are not allowed."
48+
}
1649
}
17-
}]
18-
},
19-
{
20-
"desc": "If the specified share does not exist, it will be created. You can use an existing share by specifying the full path to the folder. Make sure to specify paths to existing shares correctly, for example external USB-drive paths are of the form <em>/volumeUSB1/usbshare</em>."
21-
},
22-
{
50+
}
51+
]
52+
}, {
53+
"desc": "Permissions for download-related packages are managed with the group <b>'synocommunity'</b> in DSM. Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for further information."
54+
}
55+
]
56+
}, {
57+
"step_title": "User configuration",
58+
"items": [{
59+
"desc": "Define the User Credentials for the web interface."
60+
}, {
2361
"type": "textfield",
24-
"desc": "Control username. Defaults to nzbget",
62+
"desc": "Username for web interface Control.",
2563
"subitems": [{
2664
"key": "wizard_control_username",
27-
"desc": "Control username",
65+
"desc": "Username. Defaults to nzbget",
2866
"defaultValue": "nzbget",
2967
"validator": {
30-
"allowBlank": false
68+
"allowBlank": false
3169
}
32-
}]
33-
}, {
70+
}
71+
]
72+
}, {
3473
"type": "password",
35-
"desc": "Control password. Defaults to nzbget",
74+
"desc": "Password for web interface Control.",
3675
"subitems": [{
3776
"key": "wizard_control_password",
38-
"desc": "Control password",
77+
"desc": "Password. Defaults to nzbget",
3978
"defaultValue": "nzbget",
4079
"validator": {
41-
"allowBlank": false
80+
"allowBlank": false
4281
}
43-
}]
44-
},
45-
{
46-
"desc": "Permissions for all download-related packages are managed with the group <b>'sc-download'</b> in DSM.<br>The group 'users' is no longer used as of DSM 6.<br>Package user 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."
47-
}]
48-
}, {
82+
}
83+
]
84+
}
85+
]
86+
}, {
4987
"step_title": "NZBGet installation",
5088
"items": [{
51-
"desc": "The installer will now download the desired version of NZBGet from NZBget.net and install it. <br>In the future you should update from within NZBGet (Config > System)."
52-
},
53-
{
89+
"desc": "The installer will now download and install the specified version of NZBGet from NZBget.net.<br>In the future you should update from within NZBGet (Config > System)."
90+
}, {
5491
"type": "singleselect",
5592
"desc": "Version to install:",
5693
"subitems": [{
5794
"key": "wizard_stable_release",
5895
"desc": "Latest stable NZBGet version",
5996
"defaultValue": true
60-
}, {
97+
}, {
6198
"key": "wizard_testing_release",
6299
"desc": "Latest testing (beta) NZBGet version",
63100
"defaultValue": false
64-
}]
65-
}]
66-
}]
101+
}
102+
]
103+
}
104+
]
105+
}
106+
]
Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,106 @@
11
[{
2-
"step_title": "Configuration du service",
2+
"step_title": "Shared folder configuration",
33
"items": [{
4+
"desc": "Shared folder of downloaded files. If the specified share does not exist, it will be created."
5+
}, {
6+
"type": "combobox",
7+
"desc": "Please select a volume and a folder to use for the download files",
8+
"subitems": [{
9+
"key": "wizard_download_volume",
10+
"desc": "Volume name",
11+
"displayField": "display_name",
12+
"valueField": "volume_path",
13+
"editable": false,
14+
"mode": "remote",
15+
"api_store": {
16+
"api": "SYNO.Core.Storage.Volume",
17+
"method": "list",
18+
"version": 1,
19+
"baseParams": {
20+
"limit": -1,
21+
"offset": 0,
22+
"location": "internal"
23+
},
24+
"root": "volumes",
25+
"idProperty": "volume_path",
26+
"fields": [
27+
"display_name",
28+
"volume_path"
29+
]
30+
},
31+
"validator": {
32+
"fn": "{console.log(arguments);return true;}"
33+
}
34+
}
35+
]
36+
}, {
437
"type": "textfield",
538
"desc": "Configuration de téléchargement",
639
"subitems": [{
7-
"key": "wizard_download_dir",
40+
"key": "wizard_download_folder",
841
"desc": "Répertoire cible",
9-
"defaultValue": "/volume1/downloads",
42+
"defaultValue": "downloads",
1043
"validator": {
11-
"allowBlank": false,
12-
"regex": {
13-
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
14-
"errorText": "Le chemin doit commencer par /volume?/ ou /volumeUSB?/ avec ? le numéro du volume (1-99)."
15-
}
44+
"allowBlank": false,
45+
"regex": {
46+
"expr": "/^[^<>: */?\"]*/",
47+
"errorText": "Share name must be a folder name only. Path separators, spaces and other special chars are not allowed."
48+
}
1649
}
17-
}]
18-
},
19-
{
20-
"desc": "Si le partage saisi n'existe pas, il sera créé. Vous pouvez indiquer un partage existant en précisant le chemin absolu du répertoire. Vérifiez que votre saisie soit correcte, par exemple un disque USB externe est pointé par <em>/volumeUSB1/usbshare</em>."
21-
},
22-
{
50+
}
51+
]
52+
}, {
53+
"desc": "Permissions for download-related packages are managed with the group <b>'synocommunity'</b> in DSM. Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for further information."
54+
}
55+
]
56+
}, {
57+
"step_title": "User configuration",
58+
"items": [{
59+
"desc": "Define the User Credentials for the web interface."
60+
}, {
2361
"type": "textfield",
2462
"desc": "Utilisateur d'administration. Par défaut nzbget",
2563
"subitems": [{
2664
"key": "wizard_control_username",
2765
"desc": "Utilisateur d'administration",
2866
"defaultValue": "nzbget",
2967
"validator": {
30-
"allowBlank": false
68+
"allowBlank": false
3169
}
32-
}]
33-
}, {
70+
}
71+
]
72+
}, {
3473
"type": "password",
3574
"desc": "Mot de passe d'administration. Par défaut nzbget",
3675
"subitems": [{
3776
"key": "wizard_control_password",
3877
"desc": "Mot de passe d'administration",
3978
"defaultValue": "nzbget",
4079
"validator": {
41-
"allowBlank": false
80+
"allowBlank": false
4281
}
43-
}]
44-
},
45-
{
46-
"desc": "Les permissions de toutes les applications de téléchargement sont gérées par le groupe <b>'sc-download'</b> dans DSM.<br>Le groupe 'users' n'est plus utilisé depuis DSM 6.<br>L'utilisateur spécifique à l'application n'apparaît plus dans la plupart des interfaces de configuration.<br>Merci de lire <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> pour plus de détails."
47-
}]
48-
}, {
82+
}
83+
]
84+
}
85+
]
86+
}, {
4987
"step_title": "Installation de NZBGet",
5088
"items": [{
5189
"desc": "L'installateur va maintenant télécharger la version voulue de NZBGet depuis NZBget.net et l'installer. Vous pouvez ensuite mettre à jour depuis NZBGet (Config > System)."
52-
},
53-
{
90+
}, {
5491
"type": "singleselect",
5592
"desc": "Version à installer:",
5693
"subitems": [{
5794
"key": "wizard_stable_release",
5895
"desc": "Dernière version stable de NZBGet",
5996
"defaultValue": true
60-
}, {
97+
}, {
6198
"key": "wizard_testing_release",
6299
"desc": "Dernière version de test (beta) de NZBGet",
63100
"defaultValue": false
64-
}]
65-
}]
66-
}]
101+
}
102+
]
103+
}
104+
]
105+
}
106+
]

0 commit comments

Comments
 (0)