2016-03-28 22:14:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-05-15 17:26:39 +02:00
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-10-13 01:45:29 +02:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
2021-08-18 21:46:27 +02:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
2017-10-13 01:45:29 +02:00
|
|
|
|
2019-03-03 18:12:41 +01:00
|
|
|
# If with_carddav doesn't exist, create it
|
2023-05-03 16:25:14 +02:00
|
|
|
if [ -z "${with_carddav:-}" ]; then
|
2023-05-03 16:16:05 +02:00
|
|
|
if [ -f "$install_dir/plugins/carddav/config.inc.php" ]
|
2019-03-03 18:12:41 +01:00
|
|
|
then
|
|
|
|
with_carddav=1
|
|
|
|
else
|
|
|
|
with_carddav=0
|
|
|
|
fi
|
2019-05-18 18:42:54 +02:00
|
|
|
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
|
2019-03-03 18:12:41 +01:00
|
|
|
fi
|
|
|
|
|
2024-01-26 23:10:47 +01:00
|
|
|
# If language doesn't exist, create it
|
2023-05-03 16:25:14 +02:00
|
|
|
if [ -z "${language:-}" ]; then
|
2020-11-20 22:06:07 +01:00
|
|
|
language="en_GB"
|
|
|
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
2024-01-26 23:10:47 +01:00
|
|
|
fi
|
2020-11-20 22:06:07 +01:00
|
|
|
|
2021-12-27 17:10:09 +01:00
|
|
|
# If fpm_footprint doesn't exist, create it
|
2023-05-03 16:25:14 +02:00
|
|
|
if [ -z "${fpm_footprint:-}" ]; then
|
2021-12-27 17:10:09 +01:00
|
|
|
fpm_footprint=low
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
|
|
|
fi
|
|
|
|
|
2022-09-30 18:31:12 +02:00
|
|
|
# If fpm_free_footprint doesn't exist, create it
|
2023-05-03 16:25:14 +02:00
|
|
|
if [ -z "${fpm_free_footprint:-}" ]; then
|
2022-09-30 18:31:12 +02:00
|
|
|
fpm_free_footprint=0
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
|
|
|
fi
|
|
|
|
|
2021-12-27 17:10:09 +01:00
|
|
|
# If fpm_usage doesn't exist, create it
|
2023-05-03 16:25:14 +02:00
|
|
|
if [ -z "${fpm_usage:-}" ]; then
|
2021-12-27 17:10:09 +01:00
|
|
|
fpm_usage=low
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
|
|
|
fi
|
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Get the current version of roundcube
|
2023-05-03 16:16:05 +02:00
|
|
|
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2024-02-04 23:21:02 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
2019-05-18 18:42:54 +02:00
|
|
|
|
2024-02-04 23:21:02 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2023-05-03 16:16:05 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-10-19 12:45:44 +02:00
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2020-09-27 22:39:12 +02:00
|
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2020-09-27 22:39:12 +02:00
|
|
|
# Create a dedicated PHP-FPM config
|
2023-09-15 13:46:10 +02:00
|
|
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
2022-08-17 11:13:14 +02:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
|
|
|
#=================================================
|
2017-10-15 01:14:08 +02:00
|
|
|
# CONFIGURE ROUNDCUBE
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
2024-02-05 15:20:50 +01:00
|
|
|
setup_composer_deps
|
2024-02-04 23:31:25 +01:00
|
|
|
|
2024-02-05 15:08:07 +01:00
|
|
|
ynh_script_progression --message="Configuring Roundcube..." --weight=2
|
|
|
|
configure_roundcube
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installing ldap, automatic addressbook and contextmenu plugins..." --weight=60
|
|
|
|
install_ldap_addressbook_contextmenu_plugins
|
|
|
|
|
|
|
|
if [ $with_carddav -eq 1 ]
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Installing carddav plugin..." --weight=30
|
|
|
|
install_carddav_plugin
|
|
|
|
fi
|
|
|
|
|
2024-02-05 15:26:01 +01:00
|
|
|
ynh_script_progression --message="Updating Roundcube dependencies with Composer..." --weight=30
|
|
|
|
ynh_composer_exec --commands="update --no-dev"
|
|
|
|
|
2024-02-05 15:08:07 +01:00
|
|
|
ynh_script_progression --message="Install javascript dependencies..." --weight=10
|
|
|
|
update_javascript_deps
|
|
|
|
|
|
|
|
ynh_script_progression --message="Updating Roundcube configuration..." --weight=3
|
|
|
|
enable_plugins_in_config
|
|
|
|
|
2024-02-04 23:21:02 +01:00
|
|
|
# Migrate roundcube database
|
|
|
|
pushd "$install_dir"
|
2024-02-05 15:13:57 +01:00
|
|
|
COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn php$phpversion ./bin/update.sh --version=$oldversion -y
|
2024-02-04 23:21:02 +01:00
|
|
|
popd
|
2024-02-04 23:13:20 +01:00
|
|
|
|
2019-03-03 18:13:57 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-02 17:47:49 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|