diff --git a/.gitignore b/.gitignore
index d38c149..0f5a9f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
*.swp
*~
+*.sw[op]
+.DS_Store
diff --git a/conf/app.src b/conf/app.src
deleted file mode 100644
index 5adbbeb..0000000
--- a/conf/app.src
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCE_URL=https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6.tar.gz
-SOURCE_SUM=40e4d7505b01f401e757f7439930ed96b1245ffc3863dd326fcf21e0e5847c74
-SOURCE_SUM_PRG=sha256sum
-SOURCE_FORMAT=tar.gz
-SOURCE_IN_SUBDIR=true
diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf
deleted file mode 100644
index 017da9e..0000000
--- a/conf/extra_php-fpm.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-; Additional php.ini defines, specific to this pool of workers.
-
-php_admin_value[upload_max_filesize] = 256M
-php_admin_value[post_max_size] = 256M
diff --git a/conf/nginx.conf b/conf/nginx.conf
index a37ad3e..b86d65c 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -5,16 +5,16 @@ location __PATH__/ {
alias __INSTALL_DIR__/;
index index.php;
- client_max_body_size 50M;
+
+ client_max_body_size 256M;
+
try_files $uri $uri/ /index.php?q=$uri&$args;
# pass PHP scripts to FastCGI server
location ~ [^/]\.php(/|$) {
- fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
+ fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
include fastcgi_params_with_auth;
}
-
- # show YunoHost panel access
}
# prevent useless logs
diff --git a/config_panel.toml b/config_panel.toml
deleted file mode 100644
index e18cff6..0000000
--- a/config_panel.toml
+++ /dev/null
@@ -1,30 +0,0 @@
-version = "1.0"
-
-[main]
-name = "Roundcube configuration"
-
- [main.php_fpm_config]
- name = "PHP-FPM configuration"
-
- [main.php_fpm_config.fpm_footprint]
- ask = "Memory footprint"
- type = "select"
- choices.low = "Low, <= 20Mb per pool"
- choices.medium = "Medium, between 20Mb and 40Mb per pool"
- choices.high = "High, > 40Mb per pool"
- choices.specific = "Use specific value"
- default = "low"
-
- [main.php_fpm_config.fpm_free_footprint]
- visible = "fpm_footprint == 'specific'"
- ask = "Memory footprint of the service?"
- type = "number"
- default = "0"
- help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
-
- [main.php_fpm_config.fpm_usage]
- ask = "Expected usage"
- type = "select"
- choices = ["low", "medium", "high"]
- default = "low"
- help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
diff --git a/manifest.toml b/manifest.toml
index 9ddd162..3988a5e 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -19,6 +19,7 @@ code = "https://github.com/roundcube/roundcubemail"
[integration]
yunohost = ">= 12.1.38"
+helpers_version = "2.1"
architectures = "all"
multi_instance = true
@@ -46,7 +47,7 @@ ram.runtime = "50M"
ask.fr = "Choisissez la langue de l'application"
type = "select"
choices = ["de_DE", "en_GB", "fr_FR", "it_IT"]
- default = "en_GB"
+ default = "fr_FR"
[install.with_carddav]
ask.en = "Install CardDAV synchronization plugin?"
@@ -64,6 +65,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
+ group = "www-data:r-x"
[resources.permissions]
main.url = "/"
@@ -85,3 +87,7 @@ ram.runtime = "50M"
[resources.database]
type = "mysql"
+
+ [resources.composer]
+ version = "2.9.3"
+
\ No newline at end of file
diff --git a/sources/patches/app-fix-login-page-when-ssoed.patch b/patches/main/fix-login-page-when-ssoed.patch
similarity index 100%
rename from sources/patches/app-fix-login-page-when-ssoed.patch
rename to patches/main/fix-login-page-when-ssoed.patch
diff --git a/scripts/_common.sh b/scripts/_common.sh
index d0b3460..5c853bf 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1,17 +1,10 @@
#!/bin/bash
#=================================================
-# COMMON VARIABLES
+# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
-# Composer version
-YNH_COMPOSER_VERSION=2.5.5
-
# Plugins version
contextmenu_version=3.3.1
automatic_addressbook_version=v0.4.3
carddav_version=5.1.2
-
-#=================================================
-# EXPERIMENTAL HELPERS
-#=================================================
diff --git a/scripts/backup b/scripts/backup
index 86dca3b..a639fa7 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,46 +1,33 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# DECLARE DATA AND CONF FILES TO BACKUP
-#=================================================
-ynh_print_info --message="Declaring files to be backed up..."
+ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$install_dir"
+ynh_backup "$install_dir"
#=================================================
-# BACKUP THE NGINX CONFIGURATION
+# SYSTEM CONFIGURATION
#=================================================
-ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-
-#=================================================
-# BACKUP THE PHP-FPM CONFIGURATION
-#=================================================
+ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
-ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
-ynh_print_info --message="Backing up the MySQL database..."
+ynh_print_info "Backing up the MySQL database..."
-ynh_mysql_dump_db --database="$db_name" > db.sql
+ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
-ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
diff --git a/scripts/change_url b/scripts/change_url
index 16e0f3c..39d37fc 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -1,25 +1,17 @@
#!/bin/bash
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
-ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
+ynh_script_progression "Updating NGINX web server configuration..."
-ynh_change_url_nginx_config
+ynh_config_change_url_nginx
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Change of URL completed for $app" --last
+ynh_script_progression "Change of URL completed for $app"
diff --git a/scripts/config b/scripts/config
deleted file mode 100644
index 91c2de7..0000000
--- a/scripts/config
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source _common.sh
-source /usr/share/yunohost/helpers
-
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
-current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
-
-#=================================================
-# SPECIFIC GETTERS FOR TOML SHORT KEY
-#=================================================
-
-get__fpm_footprint() {
- # Free footprint value for php-fpm
- # Check if current_fpm_footprint is an integer
- if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
- then
- echo "specific"
- else
- echo "$current_fpm_footprint"
- fi
-}
-
-get__free_footprint() {
- # Free footprint value for php-fpm
- # Check if current_fpm_footprint is an integer
- if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
- then
- # If current_fpm_footprint is an integer, that's a numeric value for the footprint
- echo "$current_fpm_footprint"
- else
- echo "0"
- fi
-}
-
-#=================================================
-# SPECIFIC SETTERS FOR TOML SHORT KEYS
-#=================================================
-
-set__fpm_footprint() {
- if [ "$fpm_footprint" != "specific" ]
- then
- ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
- fi
-}
-
-set__fpm_free_footprint() {
- if [ "$fpm_footprint" = "specific" ]
- then
- ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
- fi
-}
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-
-ynh_app_config_validate() {
- _ynh_app_config_validate
-
- if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
- # If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
- if [ "$fpm_footprint" = "specific" ]
- then
- fpm_footprint=$fpm_free_footprint
- fi
-
- if [ "$fpm_footprint" == "0" ]
- then
- ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
-
- exit 0
- fi
- fi
-}
-
-ynh_app_config_apply() {
- _ynh_app_config_apply
-
- ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
-}
-
-ynh_app_config_run $1
diff --git a/scripts/install b/scripts/install
index 120a391..6812526 100644
--- a/scripts/install
+++ b/scripts/install
@@ -1,110 +1,76 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
-#=================================================
-
-fpm_footprint="low"
-fpm_free_footprint=0
-fpm_usage="low"
-
-#=================================================
-# STORE SETTINGS FROM MANIFEST
-#=================================================
-ynh_script_progression --message="Storing installation settings..." --weight=2
-
-ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
-ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
-ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
+ynh_app_setting_set --key=php_upload_max_filesize --value=256M
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Setting up source files..." --weight=7
+ynh_script_progression "Setting up source files..."
-# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
-
#=================================================
-# NGINX CONFIGURATION
+# APP INITIAL CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring NGINX web server..." --weight=2
-
-# Create a dedicated NGINX config
-ynh_add_nginx_config
+ynh_script_progression "Adding $app's configuration files..."
-# Create a dedicated php-fpm config
-ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
+ynh_config_add_nginx
-#=================================================
-# SPECIFIC SETUP
-#=================================================
-# INSTALL AND INITIALIZE COMPOSER
-#=================================================
-ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30
+ynh_config_add_phpfpm
-# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
-# Install composer
-#REMOVEME? ynh_install_composer
-
#=================================================
# INITIALIZE DATABASE
#=================================================
-ynh_script_progression --message="Initializing database..." --weight=3
+ynh_script_progression "Initializing database..."
-ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/SQL/mysql.initial.sql"
+ynh_mysql_db_shell < "$install_dir/SQL/mysql.initial.sql"
#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
-ynh_script_progression --message="Configuring Roundcube..." --weight=2
+ynh_script_progression "Configuring $app..."
deskey=$(ynh_string_random --length=24)
-ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php"
+ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#=================================================
# INSTALL ADDITIONAL PLUGINS
#=================================================
-ynh_script_progression --message="Installing additional plugins..." --weight=60
+ynh_script_progression "Installing additional plugins..."
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
+# For some reason there's no composer.json but it's required to run composer
+cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
+chown $app:$app "$install_dir/composer.json"
+
# Install net_LDAP
export COMPOSER_ALLOW_SUPERUSER=1
-ynh_composer_exec --commands="require kolab/net_ldap3"
+ynh_composer_exec require kolab/net_ldap3
# Install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
-ynh_composer_exec --commands="require \
+ynh_composer_exec require \
johndoh/contextmenu $contextmenu_version \
- sblaisot/automatic_addressbook $automatic_addressbook_version"
+ sblaisot/automatic_addressbook $automatic_addressbook_version
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
-ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
+ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:www-data "$install_dir/plugins/enigma/home"
# Install CardDAV plugin
if [ $with_carddav -eq 1 ]
then
- ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies"
+ ynh_composer_exec require roundcube/carddav $carddav_version --with-all-dependencies
carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0
@@ -125,8 +91,8 @@ then
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
carddav_url="https://${carddav_domain}${carddav_path%/}"
- ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
- ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
+ ynh_replace --match="{${carddav_app}_id}" --replace="$carddav_app_id" --file="$install_dir/plugins/carddav/config.inc.php"
+ ynh_replace --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php"
done
done
@@ -140,22 +106,13 @@ fi
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
-ynh_script_progression --message="Updating Roundcube configuration..." --weight=3
-
-ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
-
-# Update javascript dependencies
-(cd "$install_dir"
-/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh -v ?)
-
-# Store the config file checksum into the app settings
-ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
+ynh_script_progression "Updating $app configuration..."
-chmod 400 "$install_dir/config/config.inc.php"
-chown $app:$app "$install_dir/config/config.inc.php"
+ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins" --file="$install_dir/config/config.inc.php"
+ynh_store_file_checksum "$install_dir/config/config.inc.php"
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Installation of $app completed" --last
+ynh_script_progression "Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
index 4fb7e3c..ee9c6ec 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,27 +1,19 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# REMOVE NGINX CONFIGURATION
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
+ynh_script_progression "Removing system configurations related to $app..."
-# Remove the dedicated NGINX config
-ynh_remove_nginx_config
+ynh_config_remove_nginx
-# Remove the dedicated PHP-FPM config
-ynh_remove_fpm_config
+ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Removal of $app completed" --last
+ynh_script_progression "Removal of $app completed"
diff --git a/scripts/restore b/scripts/restore
index e87c0a6..2b1e0ac 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,52 +1,42 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring $app main directory..." --weight=4
+ynh_script_progression "Restoring $app main directory..."
-ynh_restore_file --origin_path="$install_dir"
-
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+ynh_restore "$install_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
-ynh_script_progression --message="Restoring the MySQL database..." --weight=5
+ynh_script_progression "Restoring the MySQL database..."
-ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
+ynh_mysql_db_shell < ./db.sql
#=================================================
-# RESTORE THE PHP-FPM CONFIGURATION
+# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
+ynh_script_progression "Restoring system configurations related to $app..."
-ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
-ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
-ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
+ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
+
+ynh_systemctl --service=php${php_version}-fpm --action=reload
-ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
-ynh_systemd_action --service_name=nginx --action=reload
+ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Restoration completed for $app" --last
+ynh_script_progression "Restoration completed for $app"
diff --git a/scripts/upgrade b/scripts/upgrade
index 1a8d8bb..6298016 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,111 +1,86 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# CHECK VERSION
-#=================================================
-
-upgrade_type=$(ynh_check_app_version_changed)
+ynh_app_setting_set_default --key=php_upload_max_filesize --value=256M
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
+ynh_script_progression "Ensuring downward compatibility..."
# If with_carddav doesn't exist, create it
if [ -z "${with_carddav:-}" ]; then
if [ -f "$install_dir/plugins/carddav/config.inc.php" ]
then
- with_carddav=1
+ ynh_app_setting_set_default --key=with_carddav --value="1"
else
- with_carddav=0
+ ynh_app_setting_set_default --key=with_carddav --value="0"
fi
- ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
fi
- # If language doesn't exist, create it
- if [ -z "${language:-}" ]; then
- language="en_GB"
- ynh_app_setting_set --app=$app --key=language --value=$language
-fi
+# If language doesn't exist, create it
+ynh_app_setting_set_default --key=language --value="en_GB"
-# If fpm_footprint doesn't exist, create it
-if [ -z "${fpm_footprint:-}" ]; then
- fpm_footprint=low
- ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
-fi
-
-# If fpm_free_footprint doesn't exist, create it
-if [ -z "${fpm_free_footprint:-}" ]; then
- fpm_free_footprint=0
- ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
-fi
-
-# If fpm_usage doesn't exist, create it
-if [ -z "${fpm_usage:-}" ]; then
- fpm_usage=low
- ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
-fi
+# Get the current version of roundcube
+oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
-#=================================================
-# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
+ynh_script_progression "Upgrading source files..."
-# Get the current version of roundcube
-oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
+ynh_setup_source --dest_dir="$install_dir"
-if [ "$upgrade_type" == "UPGRADE_APP" ]
-then
- ynh_script_progression --message="Upgrading source files..." --weight=3
+#=================================================
+# REAPPLY SYSTEM CONFIGURATIONS
+#=================================================
+ynh_script_progression "Upgrading system configurations related to $app..."
- # Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$install_dir"
-fi
+ynh_config_add_phpfpm
-chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+ynh_config_add_nginx
#=================================================
-# PHP-FPM CONFIGURATION
+# CONFIGURE ROUNDCUBE
#=================================================
-ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
-
-# Create a dedicated PHP-FPM config
-ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
+ynh_script_progression "Reconfiguring Roundcube..."
-# Create a dedicated NGINX config
-ynh_add_nginx_config
+deskey=$(ynh_string_random --length=24)
+ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#=================================================
-# SPECIFIC UPGRADE
-#=================================================
-# CONFIGURE ROUNDCUBE
+# UPGRADE ADDITIONAL PLUGINS
#=================================================
+ynh_script_progression "Upgrading additional plugins..."
-if [ "$upgrade_type" == "UPGRADE_APP" ]
-then
- ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1
+# Install net_LDAP
+ynh_composer_exec require kolab/net_ldap3
- deskey=$(ynh_string_random --length=24)
- ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php"
+# Update or install contextmenu and automatic_addressbook plugins
+# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
+# https://plugins.roundcube.net/packages/johndoh/contextmenu
+ynh_composer_exec update --no-dev --prefer-dist \
+ johndoh/contextmenu $contextmenu_version \
+ sblaisot/automatic_addressbook $automatic_addressbook_version
- #=================================================
- # UPDATE DEPENDENCIES WITH COMPOSER
- #=================================================
- ynh_script_progression --message="Updating dependencies with Composer..." --weight=30
+installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
+
+ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
+mkdir -p "$install_dir/plugins/enigma/home"
+chown -R $app:$app "$install_dir/plugins/enigma/home"
+
+# Update or install CardDAV plugin
+if [ $with_carddav -eq 1 ]
+then
+ ynh_composer_exec require roundcube/carddav $carddav_version --with-all-dependencies
- # Upgrade composer itself
- #REMOVEME? ynh_install_composer
+ carddav_tmp_config="../conf/carddav.config.inc.php"
+ carddav_server=0
+
+ # Copy the plugin configuration file
+ cp $install_dir/plugins/carddav/config.inc.php{.dist,}
# Check if dependencies need to be updated with Composer
if [ -f "$install_dir/composer.json" ]
@@ -121,7 +96,7 @@ then
#=================================================
# UPGRADE ADDITIONAL PLUGINS
#=================================================
- ynh_script_progression --message="Upgrading additional plugins..." --weight=30
+ ynh_script_progression "Upgrading additional plugins..."
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
@@ -156,56 +131,46 @@ then
# Look for installed and supported CardDAV servers
for carddav_app in "nextcloud" "baikal"
do
- carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
- for carddav_app_id in $carddav_app_ids
- do
- carddav_server=1
- # Append preset configuration to the config file
- cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
- # Retrieve app settings and enable relevant preset
- carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
- carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
- carddav_url="https://${carddav_domain}${carddav_path%/}"
- ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
- ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
- done
+ carddav_server=1
+ # Append preset configuration to the config file
+ cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
+ # Retrieve app settings and enable relevant preset
+ carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
+ carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
+ carddav_url="https://${carddav_domain}${carddav_path%/}"
+ ynh_replace --match="{${carddav_app}_id}" --replace="$carddav_app_id" --file="$install_dir/plugins/carddav/config.inc.php"
+ ynh_replace --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php"
done
+ done
- # Do not actually add the carddav plugin if there's no carddav server available...
- if [ $carddav_server -eq 1 ]
- then
- installed_plugins+=" 'carddav',"
- fi
+ # Do not actually add the carddav plugin if there's no carddav server available...
+ if [ $carddav_server -eq 1 ]
+ then
+ installed_plugins+=" 'carddav',"
fi
+fi
- #=================================================
- # UPDATE ROUNDCUBE CONFIGURATION
- #=================================================
- ynh_script_progression --message="Updating $app configuration..." --weight=4
-
- ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
-
- # Update JavaScript dependencies
- pushd "$install_dir"
- COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< ""
+#=================================================
+# UPDATE ROUNDCUBE CONFIGURATION
+#=================================================
+ynh_script_progression "Updating $app configuration..."
- # Store the config file checksum into the app settings
- ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
+ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins" --file="$install_dir/config/config.inc.php"
- chmod 400 "$install_dir/config/config.inc.php"
- chown $app:$app "$install_dir/config/config.inc.php"
+# Update JavaScript dependencies
+pushd "$install_dir"
+ export COMPOSER_HOME="$install_dir/.composer"
+ ynh_exec_as_app "php$php_version" ./bin/update.sh --version="?" -y <<< ""
- #=================================================
- # UPDATE ROUNDCUBE CORE
- #=================================================
- ynh_script_progression --message="Updating $app core..." --weight=4
+ ynh_script_progression "Updating $app core..."
+ ynh_exec_as_app "php$php_version" ./bin/update.sh --version=$oldversion -y
+popd
- COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y
- popd
-fi
+# Store the config file checksum into the app settings
+ynh_store_file_checksum "$install_dir/config/config.inc.php"
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Installation of $app completed" --last
+ynh_script_progression "Installation of $app completed"