2014-01-13 13:50:38 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
2022-08-06 08:43:40 +02:00
|
|
|
# GENERIC START
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2019-02-13 21:13:59 +01:00
|
|
|
source _common.sh
|
2017-09-28 18:02:10 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2019-05-06 14:14:36 +02:00
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
2017-09-28 18:02:10 +02:00
|
|
|
|
2022-08-06 08:43:40 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
2019-02-17 20:55:13 +01:00
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
2020-10-15 09:07:23 +02:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
2017-09-28 18:02:10 +02:00
|
|
|
|
2023-07-29 12:58:16 +02:00
|
|
|
# If enable_crypt doesn't exist, create it
|
|
|
|
if [ -z "${enable_crypt:-}" ]; then
|
|
|
|
enable_crypt=false
|
|
|
|
ynh_app_setting_set --app=$app --key=enable_crypt --value=$enable_crypt
|
|
|
|
fi
|
|
|
|
|
2023-04-04 19:28:44 +02:00
|
|
|
# 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
|
2017-09-28 18:02:10 +02:00
|
|
|
fi
|
|
|
|
|
2023-04-04 19:28:44 +02:00
|
|
|
# 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
|
2021-11-04 20:15:49 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-04 19:28:44 +02:00
|
|
|
# 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
|
2022-08-06 08:43:40 +02:00
|
|
|
fi
|
|
|
|
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
2019-05-06 14:14:36 +02:00
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=2
|
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-04-04 19:28:44 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir" --keep="lib/config.local.php"
|
2022-05-23 21:59:25 +02:00
|
|
|
|
|
|
|
# Remove the install.php
|
2023-04-04 19:28:44 +02:00
|
|
|
ynh_secure_remove --file=$install_dir/install.php
|
2019-05-06 14:14:36 +02:00
|
|
|
fi
|
2017-09-28 18:02:10 +02:00
|
|
|
|
2023-04-04 19:28:44 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2017-09-28 18:02:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2020-10-15 09:07:23 +02:00
|
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
2014-01-13 13:50:38 +01:00
|
|
|
|
2020-10-18 19:34:39 +02:00
|
|
|
# Create a dedicated PHP-FPM config
|
2023-04-04 19:28:44 +02:00
|
|
|
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
2017-09-28 18:02:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-08-06 08:43:40 +02:00
|
|
|
# NGINX CONFIGURATION
|
2017-09-28 18:02:10 +02:00
|
|
|
#=================================================
|
2022-08-06 08:43:40 +02:00
|
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
2017-09-28 18:02:10 +02:00
|
|
|
|
2022-08-06 08:43:40 +02:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2017-09-28 18:02:10 +02:00
|
|
|
|
2022-08-06 08:43:40 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
2020-03-03 20:23:09 +01:00
|
|
|
#=================================================
|
|
|
|
# SET THE CRON FILE
|
|
|
|
#=================================================
|
2020-10-15 09:07:23 +02:00
|
|
|
ynh_script_progression --message="Configuring the cron file..." --weight=1
|
2020-03-03 20:23:09 +01:00
|
|
|
|
2021-04-11 18:58:39 +02:00
|
|
|
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
2021-11-04 20:15:49 +01:00
|
|
|
chown root: "/etc/cron.d/$app"
|
|
|
|
chmod 644 "/etc/cron.d/$app"
|
2014-01-13 13:50:38 +01:00
|
|
|
|
2019-02-17 20:55:13 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-11-04 20:15:49 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|