1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shellinabox_ynh.git synced 2024-09-03 20:26:12 +02:00
shellinabox_ynh/scripts/upgrade
Maniack Crudelis a94b50de8b Refactoring
2017-08-28 16:34:15 +02:00

61 lines
1.7 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
port=$(ynh_app_setting_get $app port)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# If port doesn't exist, create it
if [ -z $port ]; then
port=4200
ynh_app_setting_set $app port $port
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_abort_if_errors # Exit if an error occurs during the execution of the script
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx