Skip to content

Commit

Permalink
Use SERVICE_WIZARD_SHARENAME
Browse files Browse the repository at this point in the history
  • Loading branch information
Safihre committed Jan 3, 2024
1 parent 2badbc3 commit c23e8a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 51 deletions.
2 changes: 1 addition & 1 deletion spk/sabnzbd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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
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
59 changes: 14 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,15 @@
}
}
]
},
{
"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": ""
}, {
"desc": "If you let the installer create the shared folder, it is created under the same volume as the package is installed.<br/>If you want to use a different volume for the share, you must create the shared folder in DSM Control Panel before, and enter the name of the existing share in the field above."
}, {
"desc": ""
}, {
"desc": "This package runs as internal service user <b>'sc-sabnzbd'</b> in DSM. The shared folder above is configured at installation time to be accessible by this user.<p>Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
}
]
}
]
]

0 comments on commit c23e8a4

Please sign in to comment.