2014-05-08 19:46:08 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-06-27 17:21:59 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-06-25 00:56:50 +02:00
|
|
|
|
2018-06-27 17:21:59 +02:00
|
|
|
source _common.sh
|
2017-06-25 00:56:50 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-06-27 17:21:59 +02:00
|
|
|
#=================================================
|
2021-07-10 12:49:44 +02:00
|
|
|
# CHECK VERSION
|
2018-06-27 17:21:59 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-07-10 12:49:44 +02:00
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
2021-02-06 11:58:17 +01:00
|
|
|
|
2021-07-10 12:49:44 +02:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
|
2021-12-11 22:21:42 +01:00
|
|
|
# If fpm_footprint doesn't exist, create it
|
2023-04-21 16:39:32 +02:00
|
|
|
if [ -z "${fpm_footprint:-}" ]; then
|
|
|
|
fpm_footprint=low
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
2021-12-11 22:21:42 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-21 16:39:32 +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-12-11 22:21:42 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-21 16:39:32 +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
|
2021-07-10 12:49:44 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2020-10-12 20:47:58 +02:00
|
|
|
|
2021-07-10 12:49:44 +02:00
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
|
|
|
# Copy source files
|
2023-04-21 16:39:32 +02:00
|
|
|
ynh_secure_remove $install_dir
|
2020-10-12 20:47:58 +02:00
|
|
|
|
2023-04-21 16:39:32 +02:00
|
|
|
mkdir -p $install_dir
|
2014-05-08 19:46:08 +02:00
|
|
|
|
2023-04-21 16:39:32 +02:00
|
|
|
#copy files from with_root_access folder to the install_dir
|
|
|
|
cp -a ../sources/with_root_access/. $install_dir
|
2021-07-10 12:49:44 +02:00
|
|
|
fi
|
2018-06-27 17:21:59 +02:00
|
|
|
|
2023-04-21 16:39:32 +02:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-11-20 22:30:25 +01:00
|
|
|
|
2018-06-27 17:21:59 +02:00
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2020-10-12 20:47:58 +02:00
|
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
2017-06-25 00:56:50 +02:00
|
|
|
|
2021-12-11 22:21:42 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
2018-06-27 17:21:59 +02:00
|
|
|
|
2023-04-21 16:39:32 +02:00
|
|
|
# Create a dedicated NGINX config
|
2022-10-16 20:24:43 +02:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2020-04-26 00:47:07 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2017-06-25 00:56:50 +02:00
|
|
|
|
2021-11-20 22:30:25 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|