From 711444bddb9da3cb4c2147dcfa46a7366d77014a Mon Sep 17 00:00:00 2001 From: Michael Reid Date: Thu, 3 Oct 2024 05:35:28 -0400 Subject: [PATCH] Roundcube Webmail: Update to v1.6.9 (#6243) * Bump to v1.6.9 * Update service scripts * Add resource workers and PHP profiles * Update changelog --- cross/roundcube/Makefile | 5 +- cross/roundcube/digests | 6 +- spk/roundcube/Makefile | 45 +- spk/roundcube/src/conf/PKG_DEPS | 2 - spk/roundcube/src/conf/resource | 71 +++ spk/roundcube/src/conf_6/privilege | 7 + spk/roundcube/src/conf_6/resource | 20 + spk/roundcube/src/dsm-control.sh | 24 - spk/roundcube/src/installer.sh | 173 -------- spk/roundcube/src/service-setup.sh | 437 +++++++++++++++++++ spk/roundcube/src/web/roundcube.conf | 16 + spk/roundcube/src/web/roundcube.json | 34 ++ spk/roundcube/src/wizard/install_uifile | 64 --- spk/roundcube/src/wizard/install_uifile.sh | 318 ++++++++++++++ spk/roundcube/src/wizard/uninstall_uifile | 27 -- spk/roundcube/src/wizard/uninstall_uifile.sh | 96 ++++ spk/roundcube/src/wizard/upgrade_uifile | 19 + 17 files changed, 1052 insertions(+), 312 deletions(-) delete mode 100644 spk/roundcube/src/conf/PKG_DEPS create mode 100644 spk/roundcube/src/conf/resource create mode 100644 spk/roundcube/src/conf_6/privilege create mode 100644 spk/roundcube/src/conf_6/resource delete mode 100755 spk/roundcube/src/dsm-control.sh delete mode 100755 spk/roundcube/src/installer.sh create mode 100755 spk/roundcube/src/service-setup.sh create mode 100644 spk/roundcube/src/web/roundcube.conf create mode 100644 spk/roundcube/src/web/roundcube.json delete mode 100644 spk/roundcube/src/wizard/install_uifile create mode 100644 spk/roundcube/src/wizard/install_uifile.sh delete mode 100644 spk/roundcube/src/wizard/uninstall_uifile create mode 100644 spk/roundcube/src/wizard/uninstall_uifile.sh create mode 100644 spk/roundcube/src/wizard/upgrade_uifile diff --git a/cross/roundcube/Makefile b/cross/roundcube/Makefile index cc6d66252e2..099d9018498 100644 --- a/cross/roundcube/Makefile +++ b/cross/roundcube/Makefile @@ -1,8 +1,9 @@ PKG_NAME = roundcubemail -PKG_VERS = 1.1.4 +PKG_VERS = 1.6.9 PKG_EXT = tar.gz PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS)-complete.$(PKG_EXT) -PKG_DIST_SITE = https://downloads.sourceforge.net/project/roundcubemail/roundcubemail/$(PKG_VERS) +PKG_DIST_SITE = https://github.com/roundcube/${PKG_NAME}/releases/download/${PKG_VERS} + PKG_DIR = $(PKG_NAME)-$(PKG_VERS) DEPENDS = diff --git a/cross/roundcube/digests b/cross/roundcube/digests index 2a6a69b36b6..b12d6899f1a 100644 --- a/cross/roundcube/digests +++ b/cross/roundcube/digests @@ -1,3 +1,3 @@ -roundcubemail-1.1.4-complete.tar.gz SHA1 a80d7d53b48e527827407658d7bd90145f401307 -roundcubemail-1.1.4-complete.tar.gz SHA256 9bfe88255d4ffc288f5776de1cead78352469b1766d5ebaebe6e28043affe181 -roundcubemail-1.1.4-complete.tar.gz MD5 260686b4894896744bffa2d8bb259995 +roundcubemail-1.6.9-complete.tar.gz SHA1 b63f74209cf287402f6f44b85877388899261f3c +roundcubemail-1.6.9-complete.tar.gz SHA256 b61a5f5c22f890c299e935aacfcf0870676990d8aebff0d6cdff075bf17cef4f +roundcubemail-1.6.9-complete.tar.gz MD5 e733b71422185f296a172d35ca79ef78 diff --git a/spk/roundcube/Makefile b/spk/roundcube/Makefile index 192455bb5ac..a9fb958a71a 100644 --- a/spk/roundcube/Makefile +++ b/spk/roundcube/Makefile @@ -1,39 +1,50 @@ SPK_NAME = roundcube -SPK_VERS = 1.1.4 -SPK_REV = 4 +SPK_VERS = 1.6.9 +SPK_REV = 5 SPK_ICON = src/roundcube.png -DSM_UI_DIR = app DEPENDS = cross/$(SPK_NAME) +# Pure PHP package, make sure ARCH is not defined +override ARCH= + +# Due to not obvious WebStation handling requirements +REQUIRED_MIN_DSM = 6.0 +SPK_DEPENDS = "WebStation:PHP7.4:MariaDB10:Apache2.4" -MAINTAINER = moneytoo +MAINTAINER = SynoCommunity DESCRIPTION = Roundcube is a free and open source webmail solution with a desktop-like user interface which is easy to install/configure and that runs on a standard LAMPP server. It is the same software Synology offers as Mail Station except this does not depend on Mail Server package. -ADMIN_URL = /roundcube/ DISPLAY_NAME = Roundcube Webmail -CHANGELOG = DSM6 compatible +CHANGELOG = "1. Update to v1.6.9.
2. Add PHP profiles for DSM 6.
3. Add backup and restore functions." HOMEPAGE = https://www.roundcube.net LICENSE = GPLv3 +STARTABLE = no +SERVICE_USER = auto +SERVICE_SETUP = src/service-setup.sh + +ADMIN_URL = /roundcube/ + WIZARDS_DIR = src/wizard/ -CONF_DIR = src/conf/ +SYSTEM_GROUP = http -INSTALLER_SCRIPT = src/installer.sh -SSS_SCRIPT = src/dsm-control.sh +DSM_UI_DIR = app +DSM_UI_CONFIG = src/app/config +CONF_DIR = src/conf/ -INSTALL_DEP_SERVICES = apache-web mysql -START_DEP_SERVICES = apache-web mysql +include ../../mk/spksrc.common.mk -INSTALL_PREFIX = /usr/local/$(SPK_NAME) +# Alternate conf dir for DSM 6 +ifeq ($(call version_lt, ${TCVERSION}, 7.0),1) +CONF_DIR = src/conf_6/ +endif POST_STRIP_TARGET = roundcube_extra_install -# Pure PHP package, make sure ARCH is not defined -override ARCH= - include ../../mk/spksrc.spk.mk .PHONY: roundcube_extra_install roundcube_extra_install: - install -m 755 -d $(STAGING_DIR)/app - install -m 644 src/app/config $(STAGING_DIR)/app/config + install -m 755 -d $(STAGING_DIR)/web + install -m 644 src/web/roundcube.conf $(STAGING_DIR)/web/roundcube.conf + install -m 644 src/web/roundcube.json $(STAGING_DIR)/web/roundcube.json diff --git a/spk/roundcube/src/conf/PKG_DEPS b/spk/roundcube/src/conf/PKG_DEPS deleted file mode 100644 index 9f832e23f1a..00000000000 --- a/spk/roundcube/src/conf/PKG_DEPS +++ /dev/null @@ -1,2 +0,0 @@ -[MariaDB] -dsm_min_ver=5.0-4300 diff --git a/spk/roundcube/src/conf/resource b/spk/roundcube/src/conf/resource new file mode 100644 index 00000000000..423f8201f4d --- /dev/null +++ b/spk/roundcube/src/conf/resource @@ -0,0 +1,71 @@ +{ + "mariadb10-db": { + "admin-account-m10": "root", + "admin-pw-m10": "{{wizard_mysql_password_root}}", + "create-db": { + "db-collision": "skip", + "db-name": "roundcube", + "flag": "{{wizard_create_db}}" + }, + "drop-db-uninst": true, + "drop-user-uninst": true, + "grant-user": { + "db-name": "roundcube", + "flag": "{{mysql_grant_user}}", + "host": "localhost", + "user-name": "roundcube", + "user-pw": "{{wizard_mysql_password_roundcube}}" + } + }, + "webservice": { + "pkg_dir_prepare": [ + { + "group": "http", + "mode": "0755", + "source": "/var/packages/roundcube/target/share/roundcube", + "target": "roundcube", + "user": "sc-roundcube" + } + ], + "portals": [ + { + "alias": "roundcube", + "app": "com.synocommunity.packages.roundcube", + "name": "Roundcube Webmail", + "service": "roundcube", + "type": "alias" + } + ], + "services": [ + { + "backend": 2, + "display_name": "Roundcube Webmail", + "icon": "app/images/roundcube-{0}.png", + "php": { + "backend": 8, + "extensions": [ + "curl", + "exif", + "gd", + "iconv", + "imagick", + "intl", + "ldap", + "mysqli", + "openssl", + "pdo_mysql", + "sockets", + "zip" + ], + "group": "http", + "profile_desc": "PHP Profile for roundcube", + "profile_name": "roundcube Profile", + "user": "sc-roundcube" + }, + "root": "roundcube", + "service": "roundcube", + "type": "apache_php" + } + ] + } +} diff --git a/spk/roundcube/src/conf_6/privilege b/spk/roundcube/src/conf_6/privilege new file mode 100644 index 00000000000..0b9c1e00600 --- /dev/null +++ b/spk/roundcube/src/conf_6/privilege @@ -0,0 +1,7 @@ +{ + "defaults": { + "run-as": "root" + }, + "username": "sc-roundcube", + "join-groupname": "http" +} diff --git a/spk/roundcube/src/conf_6/resource b/spk/roundcube/src/conf_6/resource new file mode 100644 index 00000000000..28a580e178d --- /dev/null +++ b/spk/roundcube/src/conf_6/resource @@ -0,0 +1,20 @@ +{ + "mariadb10-db": { + "admin-account-m10": "root", + "admin-pw-m10": "{{wizard_mysql_password_root}}", + "create-db": { + "db-collision": "skip", + "db-name": "roundcube", + "flag": "{{wizard_create_db}}" + }, + "drop-db-uninst": true, + "drop-user-uninst": true, + "grant-user": { + "db-name": "roundcube", + "flag": "{{mysql_grant_user}}", + "host": "localhost", + "user-name": "roundcube", + "user-pw": "{{wizard_mysql_password_roundcube}}" + } + } +} diff --git a/spk/roundcube/src/dsm-control.sh b/spk/roundcube/src/dsm-control.sh deleted file mode 100755 index a1cce5f6818..00000000000 --- a/spk/roundcube/src/dsm-control.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Package -PACKAGE="roundcube" -DNAME="Roundcube Webmail" - - -case $1 in - start) - exit 0 - ;; - stop) - exit 0 - ;; - status) - exit 0 - ;; - log) - exit 1 - ;; - *) - exit 1 - ;; -esac diff --git a/spk/roundcube/src/installer.sh b/spk/roundcube/src/installer.sh deleted file mode 100755 index 90e10690979..00000000000 --- a/spk/roundcube/src/installer.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/sh - -# Package -PACKAGE="roundcube" -DNAME="Roundcube Webmail" - -# Others -INSTALL_DIR="/usr/local/${PACKAGE}" -WEB_DIR="/var/services/web" -TMP_DIR="${SYNOPKG_PKGDEST}/../../@tmp" -BUILDNUMBER="$(/bin/get_key_value /etc.defaults/VERSION buildnumber)" - -USER="$([ "${BUILDNUMBER}" -ge "4418" ] && echo -n http || echo -n nobody)" -MYSQL="$([ "${BUILDNUMBER}" -ge "7321" ] && echo -n /bin/mysql || echo -n /usr/syno/mysql/bin/mysql)" -MYSQLDUMP="$([ "${BUILDNUMBER}" -ge "7321" ] && echo -n /bin/mysqldump || echo -n /usr/syno/mysql/bin/mysqldump)" -MYSQL_USER="roundcube" -MYSQL_DATABASE="roundcube" - - -preinst () -{ - # Check database - if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then - if ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then - echo "Incorrect MySQL root password" - exit 1 - fi - if ${MYSQL} -u root -p"${wizard_mysql_password_root}" mysql -e "SELECT User FROM user" | grep ^${MYSQL_USER}$ > /dev/null 2>&1; then - echo "MySQL user ${MYSQL_USER} already exists" - exit 1 - fi - if ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "SHOW DATABASES" | grep ^${MYSQL_DATABASE}$ > /dev/null 2>&1; then - echo "MySQL database ${MYSQL_DATABASE} already exists" - exit 1 - fi - fi - - exit 0 -} - -postinst () -{ - # Link - ln -s ${SYNOPKG_PKGDEST} ${INSTALL_DIR} - - # Install the web interface - cp -pR ${INSTALL_DIR}/share/${PACKAGE} ${WEB_DIR} - rm -fr ${WEB_DIR}/${PACKAGE}/installer - - # Setup database and configuration files - if [ "${SYNOPKG_PKG_STATUS}" == "INSTALL" ]; then - ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "CREATE DATABASE ${MYSQL_DATABASE}; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@'localhost' IDENTIFIED BY '${wizard_mysql_password_roundcube}';" - ${MYSQL} -u ${MYSQL_USER} -p"${wizard_mysql_password_roundcube}" ${MYSQL_DATABASE} < ${WEB_DIR}/${PACKAGE}/SQL/mysql.initial.sql - sed -e "s|^\(\$config\['db_dsnw'\] =\).*$|\1 \'mysqli://roundcube:${wizard_mysql_password_roundcube}@localhost/roundcube\';|" \ - -e "s|^\(\$config\['default_host'\] =\).*$|\1 \'${wizard_roundcube_default_host}\';|" \ - -e "s|^\(\$config\['smtp_server'\] =\).*$|\1 \'${wizard_roundcube_smtp_server}\';|" \ - -e "s|^\(\$config\['smtp_port'\] =\).*$|\1 \'${wizard_roundcube_smtp_port:=25}\';|" \ - -e "s|^\(\$config\['smtp_user'\] =\).*$|\1 \'${wizard_roundcube_smtp_user}\';|" \ - -e "s|^\(\$config\['smtp_pass'\] =\).*$|\1 \'${wizard_roundcube_smtp_pass}\';|" \ - ${WEB_DIR}/${PACKAGE}/config/config.inc.php.sample > ${WEB_DIR}/${PACKAGE}/config/config.inc.php - fi - - # Fix permissions - chown -R ${USER} ${WEB_DIR}/${PACKAGE} - - exit 0 -} - -preuninst () -{ - # Check database - if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ] && ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then - echo "Incorrect MySQL root password" - exit 1 - fi - - # Check database export location - if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" -a -n "${wizard_dbexport_path}" ]; then - if [ -f "${wizard_dbexport_path}" -o -e "${wizard_dbexport_path}/${MYSQL_DATABASE}.sql" ]; then - echo "File ${wizard_dbexport_path}/${MYSQL_DATABASE}.sql already exists. Please remove or choose a different location" - exit 1 - fi - fi - - exit 0 -} - -postuninst () -{ - # Remove link - rm -f ${INSTALL_DIR} - - # Export and remove database - if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ]; then - if [ -n "${wizard_dbexport_path}" ]; then - mkdir -p ${wizard_dbexport_path} - ${MYSQLDUMP} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} > ${wizard_dbexport_path}/${MYSQL_DATABASE}.sql - fi - ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "DROP DATABASE ${MYSQL_DATABASE}; DROP USER '${MYSQL_USER}'@'localhost';" - fi - - # Remove the web interface - rm -fr ${WEB_DIR}/${PACKAGE} - - exit 0 -} - -preupgrade () -{ - rm -fr ${TMP_DIR}/${PACKAGE} - mkdir -p ${TMP_DIR}/${PACKAGE} - - # Save pre 1.0.0 configuration files - mv ${WEB_DIR}/${PACKAGE}/config/db.inc.php ${TMP_DIR}/${PACKAGE}/ - mv ${WEB_DIR}/${PACKAGE}/config/main.inc.php ${TMP_DIR}/${PACKAGE}/ - - # Save configuration files for version >= 1.0.0 - mv ${WEB_DIR}/${PACKAGE}/config/config.inc.php ${TMP_DIR}/${PACKAGE}/ - - # Save user installed plugins - mkdir -p ${TMP_DIR}/${PACKAGE}/plugins - for plugin in ${WEB_DIR}/${PACKAGE}/plugins/*/ - do - dir=`basename $plugin` - if [ ! -d ${INSTALL_DIR}/share/${PACKAGE}/plugins/${dir} ]; then - cp -pR ${WEB_DIR}/${PACKAGE}/plugins/${dir} ${TMP_DIR}/${PACKAGE}/plugins/ - fi - done - - # Save user installed skins - mkdir -p ${TMP_DIR}/${PACKAGE}/skins - for skin in ${WEB_DIR}/${PACKAGE}/skins/*/ - do - dir=`basename $skin` - if [ ! -d ${INSTALL_DIR}/share/${PACKAGE}/skins/${dir} ]; then - cp -pR ${WEB_DIR}/${PACKAGE}/skins/${dir} ${TMP_DIR}/${PACKAGE}/skins/ - fi - done - - exit 0 -} - -postupgrade () -{ - # Restore pre 1.0.0 configuration files, still 1.0.0 compatible - mv ${TMP_DIR}/${PACKAGE}/db.inc.php ${WEB_DIR}/${PACKAGE}/config/db.inc.php - mv ${TMP_DIR}/${PACKAGE}/main.inc.php ${WEB_DIR}/${PACKAGE}/config/main.inc.php - - # Restore configuration files for version >= 1.0.0 - mv ${TMP_DIR}/${PACKAGE}/config.inc.php ${WEB_DIR}/${PACKAGE}/config/config.inc.php - - # Restore user installed plugins - for plugin in ${TMP_DIR}/${PACKAGE}/plugins/*/ - do - dir=`basename $plugin` - if [ ! -d ${WEB_DIR}/${PACKAGE}/plugins/${dir} ]; then - cp -pR ${TMP_DIR}/${PACKAGE}/plugins/${dir} ${WEB_DIR}/${PACKAGE}/plugins/ - fi - done - - # Restore user installed skins - for skin in ${TMP_DIR}/${PACKAGE}/skin/*/ - do - dir=`basename $skin` - if [ ! -d ${WEB_DIR}/${PACKAGE}/skins/${dir} ]; then - cp -pR ${TMP_DIR}/${PACKAGE}/skins/${dir} ${WEB_DIR}/${PACKAGE}/skins/ - fi - done - - rm -fr ${TMP_DIR}/${PACKAGE} - - exit 0 -} diff --git a/spk/roundcube/src/service-setup.sh b/spk/roundcube/src/service-setup.sh new file mode 100755 index 00000000000..0597c11ccd8 --- /dev/null +++ b/spk/roundcube/src/service-setup.sh @@ -0,0 +1,437 @@ + +# Package +SC_DNAME="Roundcube Webmail" +SC_PKG_PREFIX="com-synocommunity-packages-" +SC_PKG_NAME="${SC_PKG_PREFIX}${SYNOPKG_PKGNAME}" + +# Others +MYSQL="/usr/local/mariadb10/bin/mysql" +MYSQLDUMP="/usr/local/mariadb10/bin/mysqldump" +MYSQL_USER="${SYNOPKG_PKGNAME}" +MYSQL_DATABASE="${SYNOPKG_PKGNAME}" +if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -ge 7 ]; then + WEB_DIR="/var/services/web_packages" +else + WEB_DIR="/var/services/web" + # DSM 6 file and process ownership + WEB_USER="http" + WEB_GROUP="http" +fi +WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}" +SYNOSVC="/usr/syno/sbin/synoservice" +CFG_FILE="${WEB_ROOT}/config/config.inc.php" + +exec_php () +{ + PHP="/usr/local/bin/php74" + # Define the resource file + RESOURCE_FILE="${SYNOPKG_PKGDEST}/web/roundcube.json" + # Extract extensions and assign to variable + if [ -f "$RESOURCE_FILE" ]; then + PHP_SETTINGS=$(jq -r '.extensions | map("-d extension=" + . + ".so") | join(" ")' "$RESOURCE_FILE") + else + PHP_SETTINGS="" + fi + # 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 + COMMAND="${PHP} ${PHP_SETTINGS} $*" + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + /bin/su "$WEB_USER" -s /bin/sh -c "${COMMAND}" + else + $COMMAND + fi + return $? +} + +validate_preinst () +{ + # Check for modification to PHP template defaults on DSM 6 + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + WS_TMPL_DIR="/var/packages/WebStation/target/misc" + WS_TMPL_FILE="php74_fpm.mustache" + WS_TMPL_PATH="${WS_TMPL_DIR}/${WS_TMPL_FILE}" + # Check for PHP template defaults + if ! grep -q -E '^user = http$' "${WS_TMPL_PATH}" || ! grep -q -E '^listen\.owner = http$' "${WS_TMPL_PATH}"; then + echo "PHP template defaults have been modified. Installation is not supported." + exit 1 + fi + fi + + if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then + if ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then + echo "Incorrect MySQL 'root' password" + exit 1 + fi + if ${MYSQL} -u root -p"${wizard_mysql_password_root}" mysql -e "SELECT User FROM user" | grep ^${MYSQL_USER}$ > /dev/null 2>&1; then + echo "MySQL user '${MYSQL_USER}' already exists" + exit 1 + fi + if ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e "SHOW DATABASES" | grep ^${MYSQL_DATABASE}$ > /dev/null 2>&1; then + echo "MySQL database '${MYSQL_DATABASE}' already exists" + exit 1 + fi + + # Check for valid backup to restore + if [ "${wizard_roundcube_restore}" = "true" ] && [ -n "${wizard_backup_file}" ]; then + if [ ! -f "${wizard_backup_file}" ]; then + echo "The backup file path specified is incorrect or not accessible" + exit 1 + fi + # Check backup file prefix + filename=$(basename "${wizard_backup_file}") + expected_prefix="${SYNOPKG_PKGNAME}_backup_v" + + if [ "${filename#"$expected_prefix"}" = "$filename" ]; then + echo "The backup filename does not start with the expected prefix" + exit 1 + fi + fi + fi +} + +service_postinst () +{ + # Web interface setup for DSM 6 -- used by INSTALL and UPGRADE + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + # Install the web interface + echo "Installing web interface" + ${MKDIR} ${WEB_ROOT} + rsync -aX ${SYNOPKG_PKGDEST}/share/${SYNOPKG_PKGNAME}/ ${WEB_ROOT} 2>&1 + + # Install web configurations + TEMPDIR="${SYNOPKG_PKGTMP}/web" + ${MKDIR} ${TEMPDIR} + WS_CFG_DIR="/usr/syno/etc/packages/WebStation" + WS_CFG_FILE="WebStation.json" + WS_CFG_PATH="${WS_CFG_DIR}/${WS_CFG_FILE}" + TMP_WS_CFG_PATH="${TEMPDIR}/${WS_CFG_FILE}" + PHP_CFG_FILE="PHPSettings.json" + PHP_CFG_PATH="${WS_CFG_DIR}/${PHP_CFG_FILE}" + TMP_PHP_CFG_PATH="${TEMPDIR}/${PHP_CFG_FILE}" + PHP_PROF_NAME="Default PHP 7.4 Profile" + WS_BACKEND="$(jq -r '.default.backend' ${WS_CFG_PATH})" + WS_PHP="$(jq -r '.default.php' ${WS_CFG_PATH})" + RESTART_APACHE="no" + RSYNC_ARCH_ARGS="--backup --suffix=.bak --remove-source-files" + # Check if Apache is the selected back-end + if [ ! "$WS_BACKEND" = "2" ]; then + echo "Set Apache as the back-end server" + jq '.default.backend = 2' ${WS_CFG_PATH} > ${TMP_WS_CFG_PATH} + rsync -aX ${RSYNC_ARCH_ARGS} ${TMP_WS_CFG_PATH} ${WS_CFG_DIR}/ 2>&1 + RESTART_APACHE="yes" + fi + # Check if default PHP profile is selected + if [ -z "$WS_PHP" ] || [ "$WS_PHP" = "null" ]; then + echo "Enable default PHP profile" + # Locate default PHP profile + PHP_PROF_ID="$(jq -r '. | to_entries[] | select(.value | type == "object" and .profile_desc == "'"$PHP_PROF_NAME"'") | .key' "${PHP_CFG_PATH}")" + jq ".default.php = \"$PHP_PROF_ID\"" "${WS_CFG_PATH}" > ${TMP_WS_CFG_PATH} + rsync -aX ${RSYNC_ARCH_ARGS} ${TMP_WS_CFG_PATH} ${WS_CFG_DIR}/ 2>&1 + RESTART_APACHE="yes" + fi + # Check for PHP profile + if ! jq -e ".[\"${SC_PKG_NAME}\"]" "${PHP_CFG_PATH}" >/dev/null; then + echo "Add PHP profile for ${SC_DNAME}" + jq --slurpfile newProfile ${SYNOPKG_PKGDEST}/web/${SYNOPKG_PKGNAME}.json '.["'"${SC_PKG_NAME}"'"] = $newProfile[0]' ${PHP_CFG_PATH} > ${TMP_PHP_CFG_PATH} + rsync -aX ${RSYNC_ARCH_ARGS} ${TMP_PHP_CFG_PATH} ${WS_CFG_DIR}/ 2>&1 + RESTART_APACHE="yes" + fi + # Check for Apache config + if [ ! -f "/usr/local/etc/apache24/sites-enabled/${SYNOPKG_PKGNAME}.conf" ]; then + echo "Add Apache config for ${SC_DNAME}" + rsync -aX ${SYNOPKG_PKGDEST}/web/${SYNOPKG_PKGNAME}.conf /usr/local/etc/apache24/sites-enabled/ 2>&1 + RESTART_APACHE="yes" + fi + # Restart Apache if configs have changed + if [ "$RESTART_APACHE" = "yes" ]; then + if jq -e 'to_entries | map(select((.key | startswith("'"${SC_PKG_PREFIX}"'")) and .key != "'"${SC_PKG_NAME}"'")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then + echo " [WARNING] Multiple PHP profiles detected, will require restart of DSM to load new configs" + else + echo "Restart Apache to load new configs" + ${SYNOSVC} --restart pkgctl-Apache2.4 + fi + fi + # Clean-up temporary files + ${RM} ${TEMPDIR} + fi + + # Fix permissions + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT} 2>/dev/null + fi + + if [ "${SYNOPKG_PKG_STATUS}" = "INSTALL" ]; then + # Check restore action + if [ "${wizard_roundcube_restore}" = "true" ]; then + echo "The backup file is valid, performing restore" + # Extract archive to temp folder + TEMPDIR="${SYNOPKG_PKGTMP}/${SYNOPKG_PKGNAME}" + ${MKDIR} "${TEMPDIR}" + tar -xzf "${wizard_backup_file}" -C "${TEMPDIR}" 2>&1 + # Fix file ownership + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + chown -R ${WEB_USER}:${WEB_GROUP} ${TEMPDIR} 2>/dev/null + fi + + # Restore configuration file + echo "Restoring configuration to ${WEB_DIR}/config" + rsync -aX -I ${TEMPDIR}/config/config.inc.php ${CFG_FILE} 2>&1 + + # Restore user installed plugins + if [ -n "$(find "${TEMPDIR}/plugins" -maxdepth 0 -type d -not -empty 2>/dev/null)" ]; then + echo "Restoring user installed plugins to ${WEB_DIR}/plugins" + for plugin in "${TEMPDIR}/plugins"/*/ + do + dir=$(basename $plugin) + if [ ! -d "${WEB_ROOT}/plugins/${dir}" ]; then + rsync -aX -I ${TEMPDIR}/plugins/${dir} ${WEB_ROOT}/plugins/ 2>&1 + fi + done + fi + + # Restore user installed skins + if [ -n "$(find "${TEMPDIR}/skins" -maxdepth 0 -type d -not -empty 2>/dev/null)" ]; then + echo "Restoring user installed skins to ${WEB_DIR}/skins" + for skin in "${TEMPDIR}/skins"/*/ + do + dir=$(basename $skin) + if [ ! -d "${WEB_ROOT}/skins/${dir}" ]; then + rsync -aX -I ${TEMPDIR}/skins/${dir} ${WEB_ROOT}/skins/ 2>&1 + fi + done + fi + + # Update database password + MARIADB_PASSWORD_ESCAPED=$(printf '%s' "${wizard_mysql_password_roundcube}" | sed 's/[&/\]/\\&/g') + sed -i "s|\(\$config\['db_dsnw'\] = 'mysqli://roundcube:\)[^@]*\(@unix(/run/mysqld/mysqld10.sock)/roundcube';\)|\1${MARIADB_PASSWORD_ESCAPED}\2|" "${CFG_FILE}" + + # Restore the Database + echo "Restoring database to ${MYSQL_DATABASE}" + ${MYSQL} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} < ${TEMPDIR}/database/${MYSQL_DATABASE}-dbbackup.sql 2>&1 + + # Clean-up temporary files + ${RM} "${TEMPDIR}" + else + # Setup initial database structure + ${MYSQL} -u ${MYSQL_USER} -p"${wizard_mysql_password_roundcube}" ${MYSQL_DATABASE} < ${WEB_ROOT}/SQL/mysql.initial.sql + + # Setup configuration file + sed -e "s|^\(\$config\['db_dsnw'\] =\).*$|\1 \'mysqli://roundcube:${wizard_mysql_password_roundcube}@unix(/run/mysqld/mysqld10.sock)/roundcube\';|" \ + -e "s|^\(\$config\['imap_host'\] =\).*$|\1 \'${wizard_roundcube_imap_host}\';|" \ + -e "s|^\(\$config\['smtp_host'\] =\).*$|\1 \'${wizard_roundcube_smtp_host}\';|" \ + -e "s|^\(\$config\['smtp_user'\] =\).*$|\1 \'${wizard_roundcube_smtp_user}\';|" \ + -e "s|^\(\$config\['smtp_pass'\] =\).*$|\1 \'${wizard_roundcube_smtp_pass}\';|" \ + ${WEB_ROOT}/config/config.inc.php.sample > ${CFG_FILE} + + # Fix permissions + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_ROOT} 2>/dev/null + fi + fi + fi +} + +validate_preuninst () +{ + # Check database + if [ "${SYNOPKG_PKG_STATUS}" = "UNINSTALL" ] && ! ${MYSQL} -u root -p"${wizard_mysql_password_root}" -e quit > /dev/null 2>&1; then + echo "Incorrect MySQL 'root' password" + exit 1 + fi + # Check export directory + if [ "${SYNOPKG_PKG_STATUS}" = "UNINSTALL" ] && [ -n "${wizard_export_path}" ]; then + if [ ! -d "${wizard_export_path}" ]; then + # If the export path directory does not exist, create it + ${MKDIR} "${wizard_export_path}" || { + # If mkdir fails, print an error message and exit + echo "Error: Unable to create directory ${wizard_export_path}. Check permissions." + exit 1 + } + elif [ ! -w "${wizard_export_path}" ]; then + # If the export path directory is not writable, print an error message and exit + echo "Error: Unable to write to directory ${wizard_export_path}. Check permissions." + exit 1 + fi + fi +} + +service_preuninst () +{ + if [ "${SYNOPKG_PKG_STATUS}" = "UNINSTALL" ] && [ -n "${wizard_export_path}" ]; then + # Prepare archive structure + if [ -f "/var/packages/${SYNOPKG_PKGNAME}/INFO" ]; then + SC_PKG_VER=$(awk -F'"' '/version=/ {split($2, v, "-"); print v[1]}' "/var/packages/${SYNOPKG_PKGNAME}/INFO") + fi + TEMPDIR="${SYNOPKG_PKGTMP}/${SYNOPKG_PKGNAME}_backup_v${SC_PKG_VER}_$(date +"%Y%m%d")" + ${MKDIR} "${TEMPDIR}" + + # Backup the configuration file + echo "Copying previous configuration from ${WEB_ROOT}/config" + ${MKDIR} "${TEMPDIR}/config" + rsync -aX ${CFG_FILE} ${TEMPDIR}/config/ 2>&1 + + # Save user installed plugins + echo "Copying user installed plugins from ${WEB_ROOT}/plugins" + ${MKDIR} ${TEMPDIR}/plugins + for plugin in "${WEB_ROOT}/plugins"/*/ + do + dir=$(basename $plugin) + if [ ! -d "${SYNOPKG_PKGDEST}/share/${SYNOPKG_PKGNAME}/plugins/${dir}" ]; then + rsync -aX ${WEB_ROOT}/plugins/${dir} ${TEMPDIR}/plugins/ 2>&1 + fi + done + + # Save user installed skins + echo "Copying user installed skins from ${WEB_ROOT}/skins" + ${MKDIR} ${TEMPDIR}/skins + for skin in "${WEB_ROOT}/skins"/*/ + do + dir=$(basename $skin) + if [ ! -d "${SYNOPKG_PKGDEST}/share/${SYNOPKG_PKGNAME}/skins/${dir}" ]; then + rsync -aX ${WEB_ROOT}/skins/${dir} ${TEMPDIR}/skins/ 2>&1 + fi + done + + # Backup the Database + echo "Copying previous database from ${MYSQL_DATABASE}" + ${MKDIR} "${TEMPDIR}/database" + ${MYSQLDUMP} -u root -p"${wizard_mysql_password_root}" ${MYSQL_DATABASE} > ${TEMPDIR}/database/${MYSQL_DATABASE}-dbbackup.sql 2>&1 + + # Create backup archive + archive_name="$(basename "$TEMPDIR").tar.gz" + echo "Creating compressed archive of ${SC_DNAME} data in file $archive_name" + tar -C "$TEMPDIR" -czf "${SYNOPKG_PKGTMP}/$archive_name" . 2>&1 + + # Move archive to export directory + RSYNC_BAK_ARGS="--backup --suffix=.bak" + rsync -aX ${RSYNC_BAK_ARGS} "${SYNOPKG_PKGTMP}/$archive_name" "${wizard_export_path}/" 2>&1 + echo "Backup file copied successfully to ${wizard_export_path}" + + # Clean-up temporary files + ${RM} "${TEMPDIR}" + ${RM} "${SYNOPKG_PKGTMP}/$archive_name" + fi +} + +service_postuninst () +{ + # Web interface removal for DSM 6 -- used by UNINSTALL and UPGRADE + if [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 7 ]; then + # Remove the web interface + echo "Removing web interface" + ${RM} ${WEB_ROOT} + + # Remove web configurations + TEMPDIR="${SYNOPKG_PKGTMP}/web" + ${MKDIR} ${TEMPDIR} + WS_CFG_DIR="/usr/syno/etc/packages/WebStation" + PHP_CFG_FILE="PHPSettings.json" + PHP_CFG_PATH="${WS_CFG_DIR}/${PHP_CFG_FILE}" + TMP_PHP_CFG_PATH="${TEMPDIR}/${PHP_CFG_FILE}" + RESTART_APACHE="no" + RSYNC_ARCH_ARGS="--backup --suffix=.bak --remove-source-files" + # Check for PHP profile + if jq -e ".[\"${SC_PKG_NAME}\"]" "${PHP_CFG_PATH}" >/dev/null; then + echo "Removing PHP profile for ${SC_DNAME}" + jq 'del(.["'"${SC_PKG_NAME}"'"])' ${PHP_CFG_PATH} > ${TMP_PHP_CFG_PATH} + rsync -aX ${RSYNC_ARCH_ARGS} ${TMP_PHP_CFG_PATH} ${WS_CFG_DIR}/ 2>&1 + ${RM} "${WS_CFG_DIR}/php_profile/${SC_PKG_NAME}" + RESTART_APACHE="yes" + fi + # Check for Apache config + if [ -f "/usr/local/etc/apache24/sites-enabled/${SYNOPKG_PKGNAME}.conf" ]; then + echo "Removing Apache config for ${SC_DNAME}" + ${RM} /usr/local/etc/apache24/sites-enabled/${SYNOPKG_PKGNAME}.conf + RESTART_APACHE="yes" + fi + # Restart Apache if configs have changed + if [ "$RESTART_APACHE" = "yes" ]; then + if jq -e 'to_entries | map(select((.key | startswith("'"${SC_PKG_PREFIX}"'")) and .key != "'"${SC_PKG_NAME}"'")) | length > 0' "${PHP_CFG_PATH}" >/dev/null; then + echo " [WARNING] Multiple PHP profiles detected, will require restart of DSM to load new configs" + else + echo "Restart Apache to load new configs" + ${SYNOSVC} --restart pkgctl-Apache2.4 + fi + fi + # Clean-up temporary files + ${RM} ${TEMPDIR} + fi +} + +service_save () +{ + # Prepare temp folder + [ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} ] && ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} + ${MKDIR} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} + + # Save pre 1.0.0 configuration files + if [ -f "${WEB_ROOT}/config/db.inc.php" ]; then + rsync -aX ${WEB_ROOT}/config/db.inc.php ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/ 2>&1 + fi + if [ -f "${WEB_ROOT}/config/main.inc.php" ]; then + rsync -aX ${WEB_ROOT}/config/main.inc.php ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/ 2>&1 + fi + + # Save configuration files for version >= 1.0.0 + rsync -aX ${CFG_FILE} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/ 2>&1 + + # Save user installed plugins + ${MKDIR} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/plugins + for plugin in "${WEB_ROOT}/plugins"/*/ + do + dir=$(basename $plugin) + if [ ! -d "${SYNOPKG_PKGDEST}/share/${SYNOPKG_PKGNAME}/plugins/${dir}" ]; then + rsync -aX ${WEB_ROOT}/plugins/${dir} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/plugins/ 2>&1 + fi + done + + # Save user installed skins + ${MKDIR} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/skins + for skin in "${WEB_ROOT}/skins"/*/ + do + dir=$(basename $skin) + if [ ! -d "${SYNOPKG_PKGDEST}/share/${SYNOPKG_PKGNAME}/skins/${dir}" ]; then + rsync -aX ${WEB_ROOT}/skins/${dir} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/skins/ 2>&1 + fi + done +} + +service_restore () +{ + # Restore pre 1.0.0 configuration files, still 1.0.0 compatible + if [ -f "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/db.inc.php" ]; then + rsync -aX -I ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/db.inc.php ${WEB_ROOT}/config/db.inc.php 2>&1 + fi + if [ -f "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/main.inc.php" ]; then + rsync -aX -I ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/main.inc.php ${WEB_ROOT}/config/main.inc.php 2>&1 + fi + + # Restore configuration files for version >= 1.0.0 + rsync -aX -I ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/config.inc.php ${CFG_FILE} 2>&1 + + # Restore user installed plugins + if [ -n "$(find "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/plugins" -maxdepth 0 -type d -not -empty 2>/dev/null)" ]; then + for plugin in "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/plugins"/*/ + do + dir=$(basename $plugin) + if [ ! -d "${WEB_ROOT}/plugins/${dir}" ]; then + rsync -aX -I ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/plugins/${dir} ${WEB_ROOT}/plugins/ 2>&1 + fi + done + fi + + # Restore user installed skins + if [ -n "$(find "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/skins" -maxdepth 0 -type d -not -empty 2>/dev/null)" ]; then + for skin in "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/skins"/*/ + do + dir=$(basename $skin) + if [ ! -d "${WEB_ROOT}/skins/${dir}" ]; then + rsync -aX -I ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/skins/${dir} ${WEB_ROOT}/skins/ 2>&1 + fi + done + fi + + ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} +} diff --git a/spk/roundcube/src/web/roundcube.conf b/spk/roundcube/src/web/roundcube.conf new file mode 100644 index 00000000000..cc1152fdfef --- /dev/null +++ b/spk/roundcube/src/web/roundcube.conf @@ -0,0 +1,16 @@ +Alias "/roundcube" "/var/services/web/roundcube" + + + ProxySet timeout=3600 + + + + + + SetHandler "proxy:fcgi://roundcube" + + + + DirectoryIndex index.php index.htm index.html + + diff --git a/spk/roundcube/src/web/roundcube.json b/spk/roundcube/src/web/roundcube.json new file mode 100644 index 00000000000..ae74ec8a6b4 --- /dev/null +++ b/spk/roundcube/src/web/roundcube.json @@ -0,0 +1,34 @@ +{ + "backend": 8, + "custom_open_basedir": false, + "display_errors": false, + "enable_cache": true, + "enable_xdebug": false, + "extensions": [ + "curl", + "exif", + "gd", + "iconv", + "imagick", + "intl", + "ldap", + "mysqli", + "openssl", + "pdo_mysql", + "sockets", + "zip" + ], + "fpm_settings": { + "max_children": 20, + "max_spare_servers": 3, + "min_spare_servers": 1, + "mode": "dynamic", + "start_servers": 2 + }, + "open_basedir": "", + "php_settings": { + "mysqli.default_socket": "/run/mysqld/mysqld10.sock" + }, + "profile_desc": "PHP Profile for roundcube", + "profile_name": "roundcube Profile" +} diff --git a/spk/roundcube/src/wizard/install_uifile b/spk/roundcube/src/wizard/install_uifile deleted file mode 100644 index f843dbe6bf0..00000000000 --- a/spk/roundcube/src/wizard/install_uifile +++ /dev/null @@ -1,64 +0,0 @@ -[{ - "step_title": "Roundcube database configuration", - "items": [{ - "type": "password", - "desc": "Enter your MySQL password.", - "subitems": [{ - "key": "wizard_mysql_password_root", - "desc": "Root password" - }] - }, { - "type": "password", - "desc": "A 'roundcube' MySQL user and database will be created. Please enter a password for the 'roundcube' user.", - "subitems": [{ - "key": "wizard_mysql_password_roundcube", - "desc": "Roundcube password" - }] - }] -}, { - "step_title": "Roundcube hosts configuration", - "items": [{ - "type": "textfield", - "desc": "Log-in IMAP server. Leave blank to show a textbox at login. (Sample usage: 'ssl://imap.gmail.com:993', 'localhost', or blank)", - "subitems": [{ - "key": "wizard_roundcube_default_host", - "desc": "Default host" - }] - }, { - "type": "textfield", - "desc": "SMTP server. (Sample usage: 'ssl://smtp.gmail.com', 'localhost', or blank for PHP mail() function)", - "subitems": [{ - "key": "wizard_roundcube_smtp_server", - "desc": "SMTP server", - "defaultValue": "localhost" - }] - }] -}, { - "step_title": "Roundcube SMTP configuration", - "items": [{ - "type": "textfield", - "desc": "SMTP port (default is 25; 465 for SSL; 587 for submission)", - "subitems": [{ - "key": "wizard_roundcube_smtp_port", - "desc": "SMTP port", - "defaultValue": "25", - "validator": { - "allowBlank": false - } - }] - }, { - "type": "textfield", - "desc": "SMTP username (if required)", - "subitems": [{ - "key": "wizard_roundcube_smtp_user", - "desc": "SMTP username" - }] - }, { - "type": "password", - "desc": "SMTP password (if required)", - "subitems": [{ - "key": "wizard_roundcube_smtp_pass", - "desc": "SMTP password" - }] - }] -}] diff --git a/spk/roundcube/src/wizard/install_uifile.sh b/spk/roundcube/src/wizard/install_uifile.sh new file mode 100644 index 00000000000..2162503e53f --- /dev/null +++ b/spk/roundcube/src/wizard/install_uifile.sh @@ -0,0 +1,318 @@ +#!/bin/bash + +# for backwards compatability +if [ -z "${SYNOPKG_PKGDEST_VOL}" ]; then + SYNOPKG_PKGDEST_VOL="/volume1" +fi + +quote_json () +{ + sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g' +} + +page_append () +{ + if [ -z "$1" ]; then + echo "$2" + elif [ -z "$2" ]; then + echo "$1" + else + echo "$1,$2" + fi +} + +TYPE_STEP_TITLE="Roundcube Webmail installation type" +DATABASE_STEP_TITLE="Roundcube Webmail database configuration" +HOST_STEP_TITLE="Roundcube Webmail hosts configuration" +SMTP_STEP_TITLE="Roundcube Webmail SMTP configuration" +CONFIRM_STEP_TITLE="Roundcube Webmail confirm restore" +PHP_STEP_TITLE="Multiple PHP profiles" +RESTORE_BACKUP_FILE="wizard_roundcube_restore" +BACKUP_FILE_PATH="wizard_backup_file" +RESTORE_ERROR_TEXT="An empty file path is not allowed when restore is enabled." + +checkBackupRestore() +{ + CHECK_BACKUP_RESTORE=$(/bin/cat<= 0 ; i--) { + var step = wizardDialog.getStep(wizardDialog.customuiIds[i]); + if (title === step.headline) { + return step; + } + } + return null; + } + function isRestoreChecked(wizardDialog) { + var typeStep = findStepByTitle(wizardDialog, "${TYPE_STEP_TITLE}"); + if (!typeStep) { + return false; + } else { + return typeStep.getComponent("${RESTORE_BACKUP_FILE}").checked; + } + } +EOF +) + +getActiveate() +{ + ACTIVAETE=$(/bin/cat< 0' "${PHP_CFG_PATH}" >/dev/null; then + return 0 # true + else + return 1 # false + fi +} + +PAGE_ADMIN_CONFIG=$(/bin/cat< "${SYNOPKG_TEMP_LOGFILE}" +} + +main "$@" diff --git a/spk/roundcube/src/wizard/uninstall_uifile b/spk/roundcube/src/wizard/uninstall_uifile deleted file mode 100644 index b4e7d85e4d3..00000000000 --- a/spk/roundcube/src/wizard/uninstall_uifile +++ /dev/null @@ -1,27 +0,0 @@ -[{ - "step_title": "Remove Roundcube database", - "items": [{ - "desc": "Attention: The roundcube database will be removed during package uninstallation. All mailbox settings and contacts will be deleted." - }, { - "type": "password", - "desc": "Enter your MySQL password", - "subitems": [{ - "key": "wizard_mysql_password_root", - "desc": "Root password" - }] - }, { - "type": "textfield", - "desc": "Optional: Provide directory for database export. Leave blank to skip export. The directory will be created if it does not exist", - "subitems": [{ - "key": "wizard_dbexport_path", - "desc": "Database export location", - "validator": { - "allowBlank": true, - "regex": { - "expr": "/^\\\/volume[0-9]+\\\//", - "errorText": "Path should begin with /volume?/ with ? the number of the volume" - } - } - }] - }] -}] diff --git a/spk/roundcube/src/wizard/uninstall_uifile.sh b/spk/roundcube/src/wizard/uninstall_uifile.sh new file mode 100644 index 00000000000..2d18098b298 --- /dev/null +++ b/spk/roundcube/src/wizard/uninstall_uifile.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +# for backwards compatability +if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then + if [ -z "${SYNOPKG_PKGDEST_VOL}" ]; then + SYNOPKG_PKGDEST_VOL="/volume1" + fi + if [ -z "${SYNOPKG_PKGNAME}" ]; then + SYNOPKG_PKGNAME="roundcube" + fi +fi + +quote_json () +{ + sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g' +} + +page_append () +{ + if [ -z "$1" ]; then + echo "$2" + elif [ -z "$2" ]; then + echo "$1" + else + echo "$1,$2" + fi +} + +ERROR_TEXT="Path should begin with /volume?/ with ? the number of the volume" + +getValidPath() +{ + VALID_PATH=$(/bin/cat< "${SYNOPKG_TEMP_LOGFILE}" +} + +main "$@" diff --git a/spk/roundcube/src/wizard/upgrade_uifile b/spk/roundcube/src/wizard/upgrade_uifile new file mode 100644 index 00000000000..90d2683e3d9 --- /dev/null +++ b/spk/roundcube/src/wizard/upgrade_uifile @@ -0,0 +1,19 @@ +[{ + "step_title": "Roundcube Webmail upgrade", + "items": [{ + "desc": "The upgrading process ensures that your configurations and files are saved prior to updating your setup." + }, { + "type": "multiselect", + "subitems": [{ + "key": "wizard_create_db", + "desc": "Creates initial DB", + "defaultValue": false, + "hidden": true + }, { + "key": "mysql_grant_user", + "desc": "Initializes user rights", + "defaultValue": false, + "hidden": true + }] + }] +}]