#!/bin/bash set -eu #================================================= # IMPORT GENERIC HELPERS #================================================= source /usr/share/yunohost/helpers #================================================= # GENERIC START #================================================= # MANAGE SCRIPT FAILURE #================================================= # Exit on command errors and treat access to unset variables as an error ynh_abort_if_errors #================================================= # 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) db_name=$(ynh_app_setting_get $app db_name) # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die # Check destination directory DESTDIR="/var/www/$app" [[ -d $DESTDIR ]] && ynh_die \ "The destination directory '$DESTDIR' already exists.\ You should safely delete it before restoring this app." #================================================= # STANDARD RESTORATION STEPS #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= ynh_restore_file "nginx" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_restore_file "app" #================================================= # RESTORE THE MONGODB #================================================= sudo mongorestore --dbpath /var/lib/mongodb ./dump