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

77 lines
2.6 KiB
Text
Raw Normal View History

2018-10-04 02:33:13 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2022-06-08 04:32:45 +02:00
#=================================================
# STANDARD UPGRADE STEPS
2018-10-04 02:33:13 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
2021-01-10 19:10:35 +01:00
ynh_script_progression --message="Ensuring downward compatibility..." --weight=3
2018-10-04 02:33:13 +02:00
2023-01-12 09:29:55 +01:00
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
2023-01-12 09:29:55 +01:00
fpm_footprint=low
2024-02-04 18:59:58 +01:00
ynh_app_setting_set --app="$app" --key=fpm_footprint --value="$fpm_footprint"
2023-01-12 09:29:55 +01:00
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
2023-01-12 09:29:55 +01:00
fpm_free_footprint=0
2024-02-04 18:59:58 +01:00
ynh_app_setting_set --app="$app" --key=fpm_free_footprint --value="$fpm_free_footprint"
2023-01-12 09:29:55 +01:00
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
2023-01-12 09:29:55 +01:00
fpm_usage=low
2024-02-04 18:59:58 +01:00
ynh_app_setting_set --app="$app" --key=fpm_usage --value="$fpm_usage"
2021-07-01 21:28:39 +02:00
fi
2018-10-04 02:33:13 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-02-04 18:59:58 +01:00
ynh_script_progression --message="Upgrading source files..." --weight=2
2018-10-04 02:33:13 +02:00
2024-02-04 18:59:58 +01:00
# Download, check integrity, uncompress and patch the source from app.src
2024-02-04 19:06:55 +01:00
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/config.ini"
2022-06-08 04:32:45 +02:00
2024-02-04 18:59:58 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
2022-06-08 04:32:45 +02:00
#=================================================
2024-02-04 18:59:58 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2022-06-08 04:32:45 +02:00
#=================================================
2024-02-04 18:59:58 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
2022-06-08 04:32:45 +02:00
# Create a dedicated PHP-FPM config
2024-02-04 18:59:58 +01:00
ynh_add_fpm_config --phpversion="$phpversion" --usage="$fpm_usage" --footprint="$fpm_footprint"
2018-10-04 02:33:13 +02:00
2022-06-08 04:32:45 +02:00
# Create a dedicated NGINX config
2018-10-04 02:33:13 +02:00
ynh_add_nginx_config
#=================================================
2022-06-08 04:32:45 +02:00
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
2018-10-04 02:33:13 +02:00
#=================================================
2022-10-16 20:50:04 +02:00
ynh_script_progression --message="Updating a configuration file..." --weight=1
2018-10-04 02:33:13 +02:00
2024-02-04 18:59:58 +01:00
ynh_add_config --template="config.ini.sample" --destination="$install_dir/config/config.ini"
2018-10-04 02:33:13 +02:00
2024-02-04 18:59:58 +01:00
chmod 400 "$install_dir/config/config.ini"
chown "$app:$app" "$install_dir/config/config.ini"
#=================================================
# END OF SCRIPT
#=================================================
2021-01-10 19:10:35 +01:00
ynh_script_progression --message="Upgrade of $app completed" --last