2020-12-16 19:56:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
|
2021-12-09 11:50:09 +01:00
|
|
|
# If fpm_footprint doesn't exist, create it
|
2023-03-23 15:26:20 +01:00
|
|
|
if [ -z "${fpm_footprint:-}" ]; then
|
2023-01-12 09:28:16 +01:00
|
|
|
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
|
2023-03-23 15:26:20 +01:00
|
|
|
if [ -z "${fpm_free_footprint:-}" ]; then
|
2023-01-12 09:28:16 +01:00
|
|
|
fpm_free_footprint=0
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
2021-12-09 11:50:09 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# If fpm_usage doesn't exist, create it
|
2023-03-23 15:26:20 +01:00
|
|
|
if [ -z "${fpm_usage:-}" ]; then
|
2023-01-12 09:28:16 +01:00
|
|
|
fpm_usage=low
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
2021-12-09 11:50:09 +01:00
|
|
|
fi
|
|
|
|
|
2020-12-16 19:56:57 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=5
|
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir" --keep="data"
|
2023-09-02 21:00:32 +02:00
|
|
|
ynh_secure_remove --file="$install_dir/data/viewcache/*"
|
2020-12-16 19:56:57 +01:00
|
|
|
fi
|
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-05-27 13:19:07 +02:00
|
|
|
|
2020-12-16 19:56:57 +01:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
# Create a dedicated php-fpm config
|
2024-02-09 20:25:18 +01:00
|
|
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY A CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
#ynh_add_config --template="../conf/config-dist.php" --destination="$install_dir/data/config.php"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
#chmod 400 "$install_dir/data/config.php"
|
|
|
|
#chown $app "$install_dir/data/config.php"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|