#!/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) final_path=$(ynh_app_setting_get $app final_path) is_public=$(ynh_app_setting_get $app is_public) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_restore_file "$final_path" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= systemctl reload nginx