2018-05-26 10:27:01 +02:00
|
|
|
|
2016-06-20 23:43:51 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-26 10:27:01 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
source _common.sh
|
2018-05-26 10:27:01 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2016-06-20 23:43:51 +02:00
|
|
|
|
|
|
|
# Retrieve arguments
|
2019-05-15 18:42:44 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2021-08-22 08:58:18 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
2023-01-08 14:33:31 +01:00
|
|
|
proxy_path=$(ynh_app_setting_get --app=$app --key=proxy_path)
|
|
|
|
assets_path=$(ynh_app_setting_get --app=$app --key=assets_path)
|
2019-05-15 18:35:57 +02:00
|
|
|
|
2018-05-26 10:27:01 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Backup the current version of the app
|
|
|
|
ynh_backup_before_upgrade
|
|
|
|
ynh_clean_setup () {
|
|
|
|
# restore it if the upgrade fails
|
|
|
|
ynh_restore_upgradebackup
|
|
|
|
}
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2019-05-15 18:42:44 +02:00
|
|
|
#=================================================
|
2023-01-08 14:46:10 +01:00
|
|
|
# REVERSEPROXY_YNH
|
2019-05-15 18:42:44 +02:00
|
|
|
#=================================================
|
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Validate proxy destination
|
|
|
|
rp_validate_proxy_path "$proxy_path"
|
2018-05-26 10:27:01 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Configure nginx
|
2023-01-08 15:49:37 +01:00
|
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
ynh_add_nginx_config
|
2021-01-23 15:21:17 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|