From 00bd28083d6fea38fb58df2a06d70220472659a9 Mon Sep 17 00:00:00 2001
From: mreid-tt <943378+mreid-tt@users.noreply.github.com>
Date: Sat, 27 Jan 2024 00:22:00 -0400
Subject: [PATCH] Amend installer with PHP extensions
---
spk/fengoffice/Makefile | 7 ++++---
spk/fengoffice/src/service-setup.sh | 16 +++++++++++++-
spk/fengoffice/src/web/fengoffice.conf | 16 ++++++++++++++
spk/fengoffice/src/web/fengoffice.json | 29 ++++++++++++++++++++++++++
4 files changed, 64 insertions(+), 4 deletions(-)
create mode 100644 spk/fengoffice/src/web/fengoffice.conf
create mode 100644 spk/fengoffice/src/web/fengoffice.json
diff --git a/spk/fengoffice/Makefile b/spk/fengoffice/Makefile
index d4af1fcd8505..91eb8c1262c5 100644
--- a/spk/fengoffice/Makefile
+++ b/spk/fengoffice/Makefile
@@ -44,6 +44,7 @@ POST_STRIP_TARGET = fengoffice_extra_install
include ../../mk/spksrc.spk.mk
.PHONY: fengoffice_extra_install
-fengoffice_extra_install:
- install -m 755 -d $(STAGING_DIR)/app
- install -m 644 src/app/config $(STAGING_DIR)/app/config
+fengoffice_extra_install:
+ install -m 755 -d $(STAGING_DIR)/web
+ install -m 644 src/web/fengoffice.conf $(STAGING_DIR)/web/fengoffice.conf
+ install -m 644 src/web/fengoffice.json $(STAGING_DIR)/web/fengoffice.json
diff --git a/spk/fengoffice/src/service-setup.sh b/spk/fengoffice/src/service-setup.sh
index 3c3932363e9c..e9704e64c3ed 100755
--- a/spk/fengoffice/src/service-setup.sh
+++ b/spk/fengoffice/src/service-setup.sh
@@ -67,7 +67,21 @@ service_postinst ()
# Run installer
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
- cd ${WEB_DIR}/${SYNOPKG_PKGNAME}/public/install/ && QUERY_STRING="script_installer_storage[database_type]=mysql&script_installer_storage[database_host]=localhost&script_installer_storage[database_user]=${MYSQL_USER}&script_installer_storage[database_pass]=${wizard_mysql_password_fengoffice:=fengoffice}&script_installer_storage[database_name]=${MYSQL_DATABASE}&script_installer_storage[database_prefix]=fo_&script_installer_storage[database_engine]=InnoDB&script_installer_storage[absolute_url]=http://${wizard_domain_name:=$(hostname)}/${SYNOPKG_PKGNAME}&script_installer_storage[plugins][]=core_dimensions&script_installer_storage[plugins][]=workspaces&script_installer_storage[plugins][]=mail&submited=submited" php install_helper.php > /dev/null
+ # Define the resource file
+ RESOURCE_FILE="${SYNOPKG_PKGDEST}/web/fengoffice.json"
+ # Extract extensions and assign to variable
+ PHP_EXTENSIONS=$(jq -r '.extensions[] | "-dextension=" + . + ".so"' "$RESOURCE_FILE")
+ # Setup parameters for installation script
+ QUERY_STRING="script_installer_storage[database_type]=mysql&script_installer_storage[database_host]=localhost&script_installer_storage[database_user]=${MYSQL_USER}&script_installer_storage[database_pass]=${wizard_mysql_password_fengoffice:=fengoffice}&script_installer_storage[database_name]=${MYSQL_DATABASE}&script_installer_storage[database_prefix]=fo_&script_installer_storage[database_engine]=InnoDB&script_installer_storage[absolute_url]=http://${wizard_domain_name:=$(hostname)}/${SYNOPKG_PKGNAME}&script_installer_storage[plugins][]=core_dimensions&script_installer_storage[plugins][]=workspaces&script_installer_storage[plugins][]=mail&submited=submited"
+ # Prepare environment
+ COMMAND="${PHP} ${PHP_EXTENSIONS} install_helper.php"
+ cd ${WEB_DIR}/${SYNOPKG_PKGNAME}/public/install/ || exit 1
+ # Execute based on DSM version
+ if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
+ /bin/su "$WEB_USER" -s /bin/sh -c "${COMMAND}" >> ${LOG_FILE} 2>&1
+ else
+ $COMMAND >> ${LOG_FILE} 2>&1
+ fi
fi
# Fix permissions
diff --git a/spk/fengoffice/src/web/fengoffice.conf b/spk/fengoffice/src/web/fengoffice.conf
new file mode 100644
index 000000000000..57ca65aafdf6
--- /dev/null
+++ b/spk/fengoffice/src/web/fengoffice.conf
@@ -0,0 +1,16 @@
+Alias "/fengoffice" "/var/services/web/fengoffice"
+
+
+ ProxySet timeout=3600
+
+
+
+
+
+ SetHandler "proxy:fcgi://fengoffice"
+
+
+
+ DirectoryIndex index.php index.htm index.html
+
+
diff --git a/spk/fengoffice/src/web/fengoffice.json b/spk/fengoffice/src/web/fengoffice.json
new file mode 100644
index 000000000000..6dd55a852004
--- /dev/null
+++ b/spk/fengoffice/src/web/fengoffice.json
@@ -0,0 +1,29 @@
+{
+ "backend": 8,
+ "custom_open_basedir": false,
+ "display_errors": false,
+ "enable_cache": true,
+ "enable_xdebug": false,
+ "extensions": [
+ "curl",
+ "gd",
+ "imagick",
+ "imap",
+ "intl",
+ "mysqli",
+ "pdo_mysql",
+ "xmlrpc",
+ "zip"
+ ],
+ "fpm_settings": {
+ "max_children": 20,
+ "max_spare_servers": 3,
+ "min_spare_servers": 1,
+ "mode": "dynamic",
+ "start_servers": 2
+ },
+ "open_basedir": "",
+ "php_settings": {},
+ "profile_desc": "PHP Profile for fengoffice",
+ "profile_name": "fengoffice Profile"
+}