Skip to content

Commit

Permalink
avoid fix SPK_DEPENDS for DSM 6
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
hgy59 committed Oct 9, 2023
1 parent f953b19 commit 28266b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
27 changes: 18 additions & 9 deletions spk/demowebservice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ include ../../mk/spksrc.common.mk
# use the latest php version
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
PHP_VERSION = 8.2
else
PHP_VERSION = 7.4
endif

# omit dependencies for DSM 5 and SRM
ifeq ($(call version_ge, ${TCVERSION}, 6.0),1)
# only for DSM 7 we have dedicated dependencies (must match the configuration in conf/resource)
ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
SPK_DEPENDS = WebStation:PHP$(PHP_VERSION):Apache2.4
else ifeq ($(call version_ge, ${TCVERSION}, 6.0),1)
# on DSM 6 the default web server and PHP version are used
SPK_DEPENDS = WebStation
endif

WIZARDS_DIR = src/wizard/
Expand All @@ -33,14 +34,22 @@ SERVICE_WIZARD_SHARENAME = wizard_shared_folder_name
SYSTEM_GROUP = http

DSM_UI_DIR = app
# the app/config file is not used on DSM 7, the app icon is created based on the resources in CONF_DIR only.
DSM_UI_CONFIG = src/app/config

ifeq ($(call version_ge, ${TCVERSION}, 7.0),1)
# webservice resource definition is for DSM 7 only
CONF_DIR = src/conf_php$(PHP_VERSION)/
# The app/config file is not used on DSM 7 for web services, the app icon is created based on the resources in CONF_DIR only.
# With app/config on DSM 7 (sometimes) an error occurred: System error. Unable to perform this operation. Please try again later.
# Disable the creation of app/config file:
NO_SERVICE_SHORTCUT = y
endif

INSTALL_DEP_SERVICES = apache-web
START_DEP_SERVICES = apache-web
INSTUNINST_RESTART_SERVICES = apache-web
# apache-web dependency is not used:
# on DSM 7 the settings are ignored as dependency is defined in conf/resource
# on DSM 6 the package runs under the active web server (apache or nginx)
#INSTALL_DEP_SERVICES = apache-web
#START_DEP_SERVICES = apache-web
#INSTUNINST_RESTART_SERVICES = apache-web

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
Expand Down
1 change: 1 addition & 0 deletions spk/demowebservice/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ service_postinst ()

if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then
# Install the web interface
# only DSM 7+ installs the web service based on the "webservice" resource.
cp -rp "${SYNOPKG_PKGDEST}/web/${SYNOPKG_PKGNAME}" ${WEB_ROOT}/
fi

Expand Down
2 changes: 1 addition & 1 deletion spk/demowebservice/src/web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<h3>Demo Web Service</h3>
<p>This is a demo web service package for synology DSM.</p>
<p>It demonstrates how to build a package to integrate with apache web server and PHP <?php $vers=explode(".",phpversion()); echo $vers[0].'.'.$vers[1]; ?>.</p>
<p>It demonstrates how to build a package to integrate with web server and PHP.</p>
<p>It also shows how to configure and use a shared folder.</p>

<p>The source code is located in the SynoCommunity respository under <a target="_blank" href="https://github.com/SynoCommunity/spksrc/tree/master/spk/demowebservice">demowebservice</a>.</p>
Expand Down

0 comments on commit 28266b1

Please sign in to comment.