diff --git a/scripts/backup b/scripts/backup index b2a6fc5..c542202 100644 --- a/scripts/backup +++ b/scripts/backup @@ -48,3 +48,4 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/etc/nginx/conf #================================================= sudo mongodump -o "${backup_dir}/dump" +ynh_backup "${backup_dir}/dump" "dump" diff --git a/scripts/restore b/scripts/restore index 34803b8..f9fb92b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,14 +27,15 @@ 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 IF THE APP CAN BE RESTORED -#================================================= +# Check domain/path availability + sudo yunohost app checkurl "${domain}${path}" -a "$app" \ + || ynh_die -sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path_url}" -test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " +# 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