Skip to content

Commit

Permalink
Miscellaneous fixes
Browse files Browse the repository at this point in the history
- Add variable for synoservice
- Simplify DSM 6 permissions
- Fix mysqli default socket in DSM 6
- Add PHP extension zlib
- Amend uninstall wizard text
  • Loading branch information
mreid-tt committed Jan 29, 2024
1 parent c2f5bb3 commit 767c7ef
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
3 changes: 2 additions & 1 deletion spk/fengoffice/src/conf/resource
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"mysqli",
"pdo_mysql",
"xmlrpc",
"zip"
"zip",
"zlib"
],
"group": "http",
"profile_desc": "PHP Profile for fengoffice",
Expand Down
22 changes: 12 additions & 10 deletions spk/fengoffice/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ else
WEB_GROUP="http"
fi
WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}"
SYNOSVC="/usr/syno/sbin/synoservice"

service_prestart ()
{
Expand Down Expand Up @@ -140,12 +141,21 @@ service_postinst ()
${RM} ${TEMPDIR}
fi

# Fix permissions
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT}
fi

# Run installer
if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then
# 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")
PHP_SETTINGS=$(jq -r '.extensions[] | "-d extension=" + . + ".so"' "$RESOURCE_FILE")
# Fix for mysqli default socket on DSM 6
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
PHP_SETTINGS="${PHP_SETTINGS} -d mysqli.default_socket=/run/mysqld/mysqld10.sock"
fi
# Setup parameters for installation script
QUERY_STRING="\
script_installer_storage[database_type]=mysqli\
Expand All @@ -161,7 +171,7 @@ script_installer_storage[database_type]=mysqli\
&script_installer_storage[plugins][]=workspaces\
&submited=submited"
# Prepare environment
COMMAND="${PHP} ${PHP_EXTENSIONS} install_helper.php"
COMMAND="${PHP} ${PHP_SETTINGS} install_helper.php"
cd ${WEB_ROOT}/public/install/ || exit 1
# Execute based on DSM version
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
Expand All @@ -170,14 +180,6 @@ script_installer_storage[database_type]=mysqli\
$COMMAND > /dev/null 2>&1
fi
fi

# Fix permissions
if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then
chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT}/config
chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT}/cache
chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT}/upload
chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT}/tmp
fi
}

service_preuninst ()
Expand Down
7 changes: 5 additions & 2 deletions spk/fengoffice/src/web/fengoffice.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"mysqli",
"pdo_mysql",
"xmlrpc",
"zip"
"zip",
"zlib"
],
"fpm_settings": {
"max_children": 20,
Expand All @@ -23,7 +24,9 @@
"start_servers": 2
},
"open_basedir": "",
"php_settings": {},
"php_settings": {
"mysqli.default_socket": "/run/mysqld/mysqld10.sock"
},
"profile_desc": "PHP Profile for fengoffice",
"profile_name": "fengoffice Profile"
}
2 changes: 1 addition & 1 deletion spk/fengoffice/src/wizard/uninstall_uifile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PAGE_UNINSTALL_CONFIG=$(/bin/cat<<EOF
}]
}, {
"type": "textfield",
"desc": "Optional: Provide directory for database export. Leave blank to skip export. The directory will be created if it does not exist",
"desc": "Optional: Provide directory for database export. Ensure that the user 'sc-fengoffice' has write permissions to that directory. Leave blank to skip export.",
"subitems": [{
"key": "wizard_dbexport_path",
"desc": "Database export location",
Expand Down

0 comments on commit 767c7ef

Please sign in to comment.