Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use installer resources for DSM6, update TCL package #4562

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mk/spksrc.service.mk
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,18 @@ ifneq ($(strip $(SERVICE_WIZARD_SHARE)),)
'."data-share" = {"shares": [{"name": $$share, "permission":{"rw":[$$user]}} ] }' $@ 1<>$@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something interesting to note:

Since 7.0-41201, package center will create a symlink under /var/packages/[package_id]/shares/ named by share folder pointing to share folder path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to test shared folders with DSM6 anyway. I will look whether dsm6 resource worker will create such links too.

endif
SERVICE_FILES += $(DSM_CONF_DIR)/resource

# Less than DSM 6.0
else
ifneq ($(strip $(SPK_COMMANDS) $(SPK_USR_LOCAL_LINKS)),)
@echo "# List of commands to create links for" >> $@
@echo "SPK_COMMANDS=\"${SPK_COMMANDS}\"" >> $@
@echo "SPK_USR_LOCAL_LINKS=\"${SPK_USR_LOCAL_LINKS}\"" >> $@
@cat $(SPKSRC_MK)spksrc.service.create_links >> $@
ifneq ($(findstring conf,$(SPK_CONTENT)),conf)
SPK_CONTENT += conf
endif
endif

# Less than DSM 6.0
else
hgy59 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
7 changes: 1 addition & 6 deletions spk/transmission/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPK_VERS = 3.00
SPK_REV = 19
SPK_ICON = src/transmission.png

DEPENDS = cross/busybox cross/$(SPK_NAME)
DEPENDS = cross/$(SPK_NAME)

MAINTAINER = SynoCommunity
DESCRIPTION = Transmission is an easy and fast BitTorrent client. You can control it remotely with its web interface or dedicated applications.
Expand All @@ -30,13 +30,8 @@ ADMIN_PORT = $(SERVICE_PORT)

POST_STRIP_TARGET = transmission_extra_install

BUSYBOX_CONFIG = usrmng
ENV += BUSYBOX_CONFIG="$(BUSYBOX_CONFIG)"


include ../../mk/spksrc.spk.mk


.PHONY: transmission_extra_install
transmission_extra_install:
install -m 755 -d $(STAGING_DIR)/var
Expand Down
12 changes: 3 additions & 9 deletions spk/transmission/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# This gives tranmission the power to execute python scripts on completion (like TorrentToMedia).
PYTHON_DIR="/usr/local/python"
PATH="${SYNOPKG_PKGDEST}/bin:${PYTHON_DIR}/bin:${PATH}"
CFG_FILE="${SYNOPKG_PKGDEST}/var/settings.json"
CFG_FILE="${SYNOPKG_PKGVAR}/settings.json"
TRANSMISSION="${SYNOPKG_PKGDEST}/bin/transmission-daemon"

GROUP="sc-download"

SERVICE_COMMAND="${TRANSMISSION} -g ${SYNOPKG_PKGDEST}/var/ -x ${PID_FILE} -e ${LOG_FILE}"
SERVICE_COMMAND="${TRANSMISSION} -g ${SYNOPKG_PKGVAR} -x ${PID_FILE} -e ${LOG_FILE}"

service_preinst ()
{
Expand All @@ -30,7 +30,7 @@ service_postinst ()
{
if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then
# Edit the configuration according to the wizard
sed -i -e "s|@download_dir@|${wizard_download_dir:=/volume1/downloads}|g" ${CFG_FILE}
sed -i -e "s|@download_dir@|${wizard_volume}/${wizard_download_dir:=downloads}|g" ${CFG_FILE}
sed -i -e "s|@username@|${wizard_username:=admin}|g" ${CFG_FILE}
sed -i -e "s|@password@|${wizard_password:=admin}|g" ${CFG_FILE}
if [ -d "${wizard_watch_dir}" ]; then
Expand All @@ -56,12 +56,6 @@ service_postinst ()
set_syno_permissions "${wizard_incomplete_dir}" "${GROUP}"
fi
fi

# Discard legacy obsolete busybox user account
BIN=${SYNOPKG_PKGDEST}/bin
$BIN/busybox --install $BIN >> ${INST_LOG}
$BIN/delgroup "${USER}" "users" >> ${INST_LOG}
$BIN/deluser "${USER}" >> ${INST_LOG}
}


Expand Down
188 changes: 122 additions & 66 deletions spk/transmission/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -1,69 +1,125 @@
[{
"step_title": "Basic configuration",
"items": [{
"type": "textfield",
"desc": "Download directory",
"subitems": [{
"key": "wizard_download_dir",
"desc": "Download directory",
"defaultValue": "/volume1/downloads",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
}
[
{
"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)",
"subitems": [
{
"key": "wizard_download_dir",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaah, that is the trick, to use separate wizard variables for the volume and the share name!

but this should work in the demoservice too.

Copy link
Member

@publicarray publicarray Apr 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the folder name is used in the worker (not the full path), maybe we need to use basename before passing it on to jq --arg share [..]. I forgot about that too sorry.

Edit: Yes it works with the demoservice, I just messed up earlier (I still passed on the full path)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example from documentation:

"data-share": {
    "shares": [{
        "name": "music",
        "permission": {
             "ro": ["AudioStation"]
         }
    }]
}

Copy link
Member

@publicarray publicarray Apr 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hgy59 whichever way we go, (new wizards or patch to remove volumeX/ before passing the variable on) please remember to remove the if:

include ../../mk/spksrc.common.mk
ifneq ($(call version_ge, ${TCVERSION}, 7.0),1)
# SERVICE_WIZARD_SHARE is not supported for DSM7 yet
SERVICE_WIZARD_SHARE = wizard_download_dir
endif

"desc": "Download shared folder",
"defaultValue": "downloads",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\w _-]+$/",
"errorText": "Subdirectories are not supported."
}
}
}
]
},
{
"type": "textfield",
"desc": "Watch a directory for torrent files and add them to transmission. Leave empty to disable",
"subitems": [
{
"key": "wizard_watch_dir",
"desc": "Watch directory",
"validator": {
"allowBlank": true,
"regex": {
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
}
}
}
]
},
{
"type": "textfield",
"desc": "Directory to keep files in until torrent is complete. Leave empty to disable",
"subitems": [
{
"key": "wizard_incomplete_dir",
"desc": "Incomplete directory",
"validator": {
"allowBlank": true,
"regex": {
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
}
}
}
]
}
}]
}, {
"type": "textfield",
"desc": "Watch a directory for torrent files and add them to transmission. Leave empty to disable",
"subitems": [{
"key": "wizard_watch_dir",
"desc": "Watch directory",
"validator": {
"allowBlank": true,
"regex": {
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
}
]
},
{
"step_title": "Basic configuration",
"items": [
{
"type": "textfield",
"desc": "Web interface username. Defaults to admin",
"subitems": [
{
"key": "wizard_username",
"desc": "Username"
}
]
},
{
"type": "password",
"desc": "Web interface password. Defaults to admin",
"subitems": [
{
"key": "wizard_password",
"desc": "Password"
}
]
}
}]
}, {
"type": "textfield",
"desc": "Directory to keep files in until torrent is complete. Leave empty to disable",
"subitems": [{
"key": "wizard_incomplete_dir",
"desc": "Incomplete directory",
"validator": {
"allowBlank": true,
"regex": {
"expr": "/^\\\/volume\\w*[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volumename?/ where volumename can be 'volume' or also 'volumeUSB' and ? is the volume number (1-99)."
}
]
},
{
"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."
}
}]
}]
}, {
"step_title": "Basic configuration",
"items": [{
"type": "textfield",
"desc": "Web interface username. Defaults to admin",
"subitems": [{
"key": "wizard_username",
"desc": "Username"
}]
}, {
"type": "password",
"desc": "Web interface password. Defaults to admin",
"subitems": [{
"key": "wizard_password",
"desc": "Password"
}]
}]
}, {
"step_title": "DSM Permissions",
"items": [{
"desc": "Permissions for all download-related packages of SynoCommunity 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."
}]
}]
]
}
]
2 changes: 1 addition & 1 deletion spk/transmission/src/wizard/install_uifile_fre
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
}, {
"step_title": "Permissions DSM",
"items": [{
"desc": "Les permissions de toutes les applications de SynoCommunity liés au 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."
"desc": "Merci de lire <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> pour plus de détails."
}]
}]
57 changes: 54 additions & 3 deletions spk/transmission/src/wizard/upgrade_uifile
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
[{
"step_title": "DSM Permissions",
"items": [{
"desc": "Permissions for all download-related packages of SynoCommunity 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."
"desc": "Please read <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> for details."
},
{
"desc": "<strong style='color:red'>NOTE:</strong> The package upgrade will try to set the correct permissions on your folders. If you get permission errors within Transmission, manually set Read/Write permissions for the 'sc-download' group on the reported folders using File Station."
"desc": "<strong style='color:red'>NOTE:</strong> The package upgrade will try to set the correct permissions on your folders. If you get permission errors within Transmission, manually set Read/Write permissions on the reported folders using File Station."
},
{
"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)",
"subitems": [
{
"key": "wizard_download_dir",
"desc": "Download shared folder",
"defaultValue": "downloads",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[\\w _-]+$/",
"errorText": "Subdirectories are not supported."
}
}
}
]
}]
}]
}]
6 changes: 3 additions & 3 deletions spk/transmission/src/wizard/upgrade_uifile_fre
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[{
"step_title": "Permissions DSM",
"items": [{
"desc": "Les permissions de toutes les applications de SynoCommunity liés au 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."
"desc": "Merci de lire <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a> pour plus de détails."
},
{
"desc": "<strong style='color:red'>NOTE:</strong> La mise à jour de l'application va tenter de corriger les permissions des répertoires. En cas d'erreur de permission dans Transmission, donner les droits de Lecture/Ecriture au groupe 'sc-download' sur les répertoires mentionnés depuis File Station."
"desc": "En cas d'erreur de permission dans Transmission, donner les droits de Lecture/Ecriture sur les repertoires mentionnés depuis File Station."
}]
}]
}]