1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wemawema_ynh.git synced 2024-10-01 13:34:56 +02:00
wemawema_ynh/scripts/upgrade

98 lines
3.1 KiB
Text
Raw Normal View History

2017-10-28 19:28:51 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
2017-10-28 19:28:51 +02:00
2023-05-07 18:50:05 +02:00
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
2017-10-28 19:28:51 +02:00
2023-05-07 18:50:05 +02:00
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
2017-10-28 19:28:51 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
2017-10-28 19:28:51 +02:00
2023-05-07 18:50:05 +02:00
# If install_dir doesn't exist, create it
if [ -z $install_dir ]; then
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set $app install_dir $install_dir
2017-10-28 19:28:51 +02:00
fi
2021-03-15 11:40:34 +01:00
# Cleaning legacy permissions
2023-05-07 18:50:05 +02:00
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
2021-03-15 11:40:34 +01:00
ynh_app_setting_delete --app=$app --key=is_public
fi
2017-10-28 19:28:51 +02:00
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
# Backup the current version of the app
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
2017-10-28 19:28:51 +02:00
# restore it if the upgrade fails
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_restore_upgradebackup
2017-10-28 19:28:51 +02:00
}
# Exit if an error occurs during the execution of the script
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_abort_if_errors
2017-10-28 19:28:51 +02:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
2023-05-07 18:50:05 +02:00
ynh_setup_source --dest_dir="$install_dir"
fi
2017-10-28 19:28:51 +02:00
2021-06-02 22:38:01 +02:00
# Set right permissions for curl installation
2023-05-07 18:50:05 +02:00
chmod 750 $install_dir
chown -R www-data: $install_dir
2021-06-02 22:38:01 +02:00
2017-10-28 19:28:51 +02:00
#=================================================
# NGINX CONFIGURATION
#=================================================
2020-11-17 09:08:16 +01:00
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
2017-10-28 19:28:51 +02:00
2020-11-17 09:08:16 +01:00
# Create a dedicated NGINX config
2017-10-28 19:28:51 +02:00
ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
2023-05-07 18:50:05 +02:00
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
2017-10-28 19:28:51 +02:00
ynh_script_progression --message="Upgrade of $app completed" --last