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/restore
Maniack Crudelis a94b50de8b Refactoring
2017-08-28 16:34:15 +02:00

64 lines
1.8 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
#=================================================
# 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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# INSTALL SHELLINABOX
#=================================================
ynh_package_update
ynh_package_install shellinabox
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_restore_file "/etc/shellinabox"
ynh_restore_file "/etc/default/shellinabox"
systemctl restart shellinabox
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx