2016-05-04 14:17:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit on command errors and treat access to unset variables as an error
|
2017-04-20 19:34:26 +02:00
|
|
|
set -eu
|
2016-05-04 14:17:07 +02:00
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2017-04-20 19:34:26 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2017-04-20 19:34:26 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-05-07 02:00:48 +02:00
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
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"
|
2018-03-08 00:25:33 +01:00
|
|
|
|
|
|
|
# Allow the service to log in syslog
|
|
|
|
ynh_replace_string " -- -q --background" " -- --background" "/etc/init.d/shellinabox"
|
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
systemctl restart shellinabox
|
|
|
|
|
2017-12-04 22:02:18 +01:00
|
|
|
#=================================================
|
|
|
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
yunohost service add $app
|
|
|
|
|
2017-08-28 16:34:15 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
systemctl reload nginx
|