From 3910125ff030b123b88d7598ab595e8759c78b57 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 11 Jan 2022 13:33:20 +0100 Subject: [PATCH] Update restore --- scripts/restore | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 79a58ae..13ff473 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,12 +31,24 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=adminusername) +#================================================= +# CHECK IF THE APP CAN BE RESTORED +#================================================= +ynh_script_progression --message="Validating restoration parameters..." --weight=1 + # Check user parameter ynh_user_exists "$admin" || ynh_die "The chosen admin user does not exist." # Check Final Path availability test ! -e "$final_path" || ynh_die "This path already contains a folder" +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -47,8 +59,21 @@ test getent passwd "$app" &>/dev/null || \ useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \ ynh_die "Unable to create $app system account" -# Restore all files -ynh_restore +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$final_path" + +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$DATADIR" --not_mandatory + +mkdir -p $DATADIR #================================================= # RESTORE THE MYSQL DATABASE