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

framework: store package options in variables #3763

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions mk/spksrc.service.installer
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ save_wizard_variables ()
if [ -n "${SHARE_PATH}" ]; then
echo "SHARE_PATH=${SHARE_PATH}" >> ${INST_VARIABLES}
fi
# Restriction permissions to protect sensitive options
chmod go-rwx ${INST_VARIABLES}
chown ${EFF_USER} ${INST_VARIABLES}
}

# Remove user from system and from groups it is member of
Expand Down
4 changes: 2 additions & 2 deletions spk/demoservice/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = demoservice
SPK_VERS = 1.2
SPK_REV = 6
SPK_VERS = 1.3
SPK_REV = 10
SPK_ICON = src/demoservice.png

override ARCH=
Expand Down
2 changes: 1 addition & 1 deletion spk/demoservice/PLIST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bin:README
rsc:README
3 changes: 2 additions & 1 deletion spk/demoservice/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ service_preinst ()
service_postinst ()
{
echo "service_postinst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
echo "CUSTOM_OPTION=${wizard_custom_option}" >> ${INST_VARIABLES}
}

service_preuninst ()
{
echo "service_preuninst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_postinst ()
service_postuninst ()
{
echo "service_postuninst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}
Expand Down
4 changes: 4 additions & 0 deletions spk/demoservice/src/wizard/install_uifile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"errorText": "Not allowed character in group name"
}
}
},
{
"key": "wizard_custom_option",
"desc": "Demoservice custom option",
}
]
}
Expand Down
63 changes: 63 additions & 0 deletions spk/demoservice/src/wizard/upgrade_uifile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/sh

INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"

# Reload wizard variables stored by postinst
if [ -r "${INST_VARIABLES}" ]; then
. "${INST_VARIABLES}"
fi

cat <<EOF > $SYNOPKG_TEMP_LOGFILE
[
{
"step_title": "Example configuration for demoservice",
"items": [
{
"type": "textfield",
"desc": "Download configuration",
"subitems": [
{
"key": "wizard_download_dir",
"desc": "Download location",
"defaultValue": "${SHARE_PATH}",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^\\\/volume[0-9]{1,2}\\\/[^<>: */?\"]*/",
"errorText": "Path should begin with /volume?/ where ? is volume number (1-99)"
}
}
},
{
"key": "wizard_group",
"desc": "DSM group",
"defaultValue": "${GROUP}",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^[^<>:*/?\"]*$/",
"errorText": "Not allowed character in group name"
}
}
},
{
"key": "wizard_custom_option",
"desc": "Demoservice custom option",
"defaultValue": "${CUSTOM_OPTION}",
}
]
}
]
},
{
"step_title": "Attention! DSM Permissions",
"items": [
{
"desc": "Permissions are managed with the group <b>'sc-download'</b> in DSM."
}
]
}
]
EOF
exit 0