1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/h5ai_ynh.git synced 2024-09-03 20:36:25 +02:00
h5ai_ynh/scripts/upgrade

86 lines
2.6 KiB
Text
Raw Normal View History

2020-07-08 09:49:14 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2022-03-31 19:39:38 +02:00
source _common.sh
2020-07-08 09:49:14 +02:00
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2022-10-16 20:26:47 +02:00
ynh_script_progression --message="Loading settings..." --weight=1
2020-07-08 09:49:14 +02:00
2023-02-17 22:34:43 +01:00
if [[ "$path" != "/" ]]
2020-07-08 09:49:14 +02:00
then
2023-02-17 22:45:03 +01:00
# We use the path url name (e.g. /documents) instead of h5ai for convenience...
install_dir=/var/www/$path
2020-07-08 09:49:14 +02:00
else
2023-02-17 22:45:03 +01:00
install_dir=/var/www/$app
2020-07-08 09:49:14 +02:00
fi
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
2022-10-16 20:26:47 +02:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
2023-01-07 00:06:27 +01:00
# If fpm_footprint doesn't exist, create it
2023-02-17 22:46:55 +01:00
if [ -z "${fpm_footprint:-}" ]; then
2023-01-07 00:06:27 +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-02-17 22:46:55 +01:00
if [ -z "${fpm_free_footprint:-}" ]; then
2023-01-07 00:06:27 +01:00
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
2023-02-17 22:46:55 +01:00
if [ -z "${fpm_usage:-}" ]; then
2023-01-07 00:06:27 +01:00
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
2020-07-08 09:49:14 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
2022-04-04 20:21:11 +02:00
ynh_script_progression --message="Upgrading source files..." --weight=4
2020-07-08 09:49:14 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-02-17 22:34:43 +01:00
ynh_setup_source --dest_dir="$install_dir"
2020-07-08 09:49:14 +02:00
fi
2023-02-17 22:34:43 +01:00
chown -R $app:www-data "$install_dir"
2021-05-26 12:16:06 +02:00
2022-03-31 19:39:38 +02:00
#=================================================
2023-02-17 22:45:03 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2022-03-31 19:39:38 +02:00
#=================================================
2023-02-17 22:45:03 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4
2022-03-31 19:39:38 +02:00
# Create a dedicated PHP-FPM config
2023-01-07 00:06:27 +01:00
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
2022-10-16 20:26:47 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2020-07-08 09:49:14 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2022-04-04 20:12:41 +02:00
ynh_script_progression --message="Upgrade of $app completed" --last