mirror of
https://github.com/YunoHost-Apps/roundcube_ynh.git
synced 2024-09-03 20:16:28 +02:00
117 lines
3.7 KiB
Bash
117 lines
3.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
# 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
|
|
else
|
|
with_carddav=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 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
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
# Get the current version of roundcube
|
|
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
|
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
|
|
|
# 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"
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
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
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC UPGRADE
|
|
#=================================================
|
|
# CONFIGURE ROUNDCUBE
|
|
#=================================================
|
|
setup_composer_deps
|
|
|
|
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
|
|
|
|
ynh_script_progression --message="Updating Roundcube dependencies with Composer..." --weight=30
|
|
ynh_composer_exec --commands="update --no-dev"
|
|
|
|
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
|
|
|
|
# Migrate roundcube database
|
|
pushd "$install_dir"
|
|
COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn php$phpversion ./bin/update.sh --version=$oldversion -y
|
|
popd
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|