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

EFF_USER and USER is missing for DSM7 in service-script.sh #5041

Closed
publicarray opened this issue Jan 3, 2022 · 5 comments · Fixed by #5649
Closed

EFF_USER and USER is missing for DSM7 in service-script.sh #5041

publicarray opened this issue Jan 3, 2022 · 5 comments · Fixed by #5649

Comments

@publicarray
Copy link
Member

publicarray commented Jan 3, 2022

root@NAS /v/h/seby# cat /var/packages/dante-sockd/scripts/service-setup
### Generic variables and functions
### -------------------------------

if [ -z "${SYNOPKG_PKGNAME}" ] || [ -z "${SYNOPKG_DSM_VERSION_MAJOR}" ]; then
  echo "Error: Environment variables are not set." 1>&2;
  echo "Please run me using synopkg instead. Example: \"synopkg start [packagename]\"" 1>&2;
  exit 1
fi

# Service port
SERVICE_PORT="@socks_port@"
[..]

spksrc/mk/spksrc.service.mk

Lines 112 to 127 in 95fe355

$(DSM_SCRIPTS_DIR)/service-setup:
$(create_target_dir)
@echo "### Generic variables and functions" > $@
@echo '### -------------------------------' >> $@
@echo '' >> $@
@echo 'if [ -z "$${SYNOPKG_PKGNAME}" ] || [ -z "$${SYNOPKG_DSM_VERSION_MAJOR}" ]; then' >> $@
@echo ' echo "Error: Environment variables are not set." 1>&2;' >> $@
@echo ' echo "Please run me using synopkg instead. Example: \"synopkg start [packagename]\"" 1>&2;' >> $@
@echo ' exit 1' >> $@
@echo 'fi' >> $@
@echo '' >> $@
ifneq ($(strip $(SERVICE_USER)),)
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
@echo USER=\"sc-$(SPK_USER)\" >> $@
@echo EFF_USER=\"sc-$(SPK_USER)\" >> $@
else

@publicarray publicarray changed the title EFF_USER and USER is empty for DSM7 in service-script.sh EFF_USER and USER is missing for DSM7 in service-script.sh Jan 3, 2022
@publicarray
Copy link
Member Author

Removing the SERVICE_USER check at line 123 fixes the issue

@publicarray
Copy link
Member Author

publicarray commented Jan 3, 2022

Defining SERVICE_USER would fix it too but DSM7 doesn't really have that concept anymore, and I thought they ($USER) were previously defined anyway. But I might be wrong on that.

@publicarray
Copy link
Member Author

I think the use of SERVICE_USER should not impact the $USER variable. What does the EFF_USER stand for anyway? Shouldn't it be something like SRV_USER or SERVICE_USER? Just my 2 cents.

@BenjV
Copy link

BenjV commented Jan 5, 2022

$EFF_USER should contains of the $USER with the prefix "sc-" for DMS 6 and higher
So $EFF_USER = "sc"- + $USER when DSM >= 6 else $USER

In pre DSM 6 packages the name of the user was the same as the name of the package (e.g. $SYNOPKG_PKGNAME)
When @ymartin59 created the framework for DSM 6, we had to decide how to support older versions of DSM (DSM 5 and DSM 4).
We decided to add the "sc-" prefix for the username of packages and for installing on pre-DSM 6 the username without this prefix was kept.

So in every package the EFF_USER is used and depending on the DSM version it is equal to the USER if the DSM version is lower then 6 else (DSM6 and higher) and the "sc-" prefix is added to create EFF_USER.

Because of the fact that DSM 7 packages can only be installed on DSM 7, it could be that this is no longer necessary.

@publicarray
Copy link
Member Author

Thanks @BenjV I much appreciate the history lesson :)

@hgy59 hgy59 added the dsm 7 label Jul 7, 2022
hgy59 added a commit that referenced this issue Oct 14, 2023
* redesign shared folder handling
- avoid use of wizard variable `wizard_volume` in installer.functions
- dsm 7 preinst function must not validate volume of shared folder, as shares are fully provided by DSM
- update evaluation of SHARED_PATH on DSM 7
- simplify EFF_USER definition (we do not support to run DSM 5 packages on DSM 6 anymore)

* add Makefile variable SERVICE_WIZARD_SHARENAME for new approach
- introduce variable SERVICE_WIZARD_SHARENAME for redesigned share folder handling
- document make variables SERVICE_WIZARD_SHARE and USE_DATA_SHARE_WORKER as deprecated
- update demoservice with new shared folder handling
- use start.sh to start demoservice since SERVICE_COMMAND with parameters does not work on DSM with ash shell
- use python3 for demoservice, when available in path
- log SHARE_PATH and SHARE_NAME variables in demoservice installer log
- fix function load_variables_from_file (does not work when called within sub shell by call_func)
- drop support for SERVICE_EXE (deprecated since DSM 7 support)
- drop support for SERVICE_WIZARD_GROUP
- initialize and log variables for shared folder in function linitialize_variables
- use "sc-" user prefix for DSM 5 too
- remove check for shared folder existence in preinst
- fix load_variables_from_file (avoid use of cut with --delimiter, to make it POSIX compatible)
- avoid to add duplicate user to shared folders without resource workers (SRM, DSM5, DSM6 with SERVICE_WIZARD_SHARE)
- fix save_wizard_variables to not delete installer-variables when variables are not set (i.e. for UPGRADE without wizard)

* fix evaluation of share path
- use realpath (abspath is not supported on DSM)

* fix DSM 7 uninstaller
- use realpath to remove files in etc folder

* cleanups
- avoid reading already defined variables from installer-variables
- save wizard variables after creation of shared folders (SHARE_PATH is set to full path at creation time) (DSM 6, DSM 5)

* fix icon creation for web service packages
- create icons when DSM_UI_CONFIG is defined

* add demowebservice package
- add demowebservice to document how to create a web service apps
- use shared folder to show how to access shared folders by the package

* update demowebserice
- support DSM 5
- fully support dark mode

* update cops
- remove workaround to create package icons

* update adminer
- adjust patch to current version

* spksrc.service.mk: fix installation of app/config
- fix installation of app/config when DSM_UI_CONFIG is defined
- ensure DSM_UI_CONFIG has privilege over generated app/config (and is not affected by NO_SERVICE_SHORTCUT)
- add Makefile variable SERVICE_DESC to define DESC property in app/config (the whole package description is often not ment to be shown as tooltip of the app icon)
- remove the extra installation of app/config since this is fixed now (demowebservice, adminer, cops, owncloud)
- remove obsolete dsm-control.sh in adminer package (same is created by the framework with STARTABLE=no)
- throw error when SERVICE_USER is not properly defined (only 'auto' is supported)

* spk/aria2: remove SERVICE_WIZARD_GROUP
- SERVICE_WIZARD_GROUP is not supported anymore

* enable NO_SERVICE_SHORTCUT for DSM_UI_CONFIG
- fix NO_SERVICE_SHORTCUT to be applied independent of DSM_UI_CONFIG:
- it must be possible to disable creation of app/config file when app (webservice) is fully defined in conf/resource
- force icon creation when DSM_UI_CONFIG is defined
- NO_SERVICE_SHORTCUT must be ignored for icon creation, when DSM_UI_CONFIG is defined

* enhance demowebservice:
- document and avoid web server and PHP dependency as SPK_DEPENDS for all except DSM 7
- DSM 6: remove conf/resorce for webservice (supported on DSM 7 only)
- add port 8889 for Web Portal on DSM 7
- add install wizard page with remarks
- reverse proxy configuration on DSM 7 does not work and is not added to resource file (#5544)

* always define EFF_USER for service-setup on DSM 7 (fixes #5041)

* creation of shared folder always requires a service user
- force SERVICE_USER = auto with SERVICE_WIZARD_SHARENAME
- remove SERVICE_USER = auto in demowebservice Makefile as defined by framework now (forced by SERVICE_WIZARD_SHARENAME)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants