From 353048d4b3b0f5b73b61416d7efb3f4e25537669 Mon Sep 17 00:00:00 2001 From: Matthew Lopez <73856503+MatthewL246@users.noreply.github.com> Date: Fri, 10 May 2024 21:20:19 -0400 Subject: [PATCH] Create full environment reset script --- scripts/full-reset.sh | 31 +++++++++++++++++++++++++++++++ scripts/internal/framework.sh | 1 + 2 files changed, 32 insertions(+) create mode 100755 scripts/full-reset.sh diff --git a/scripts/full-reset.sh b/scripts/full-reset.sh new file mode 100755 index 0000000..b980aad --- /dev/null +++ b/scripts/full-reset.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# shellcheck source=./internal/framework.sh +source "$(dirname "$(realpath "$0")")/internal/framework.sh" +set_description "This fully resets the Pretendo environment by deleting all server data." +add_option "-f --force" "force" "Skip the confirmation prompt when resetting" +add_option "--no-backup" "no_backup" "Skip the backup step, very dangerous!" +parse_arguments "$@" + +print_warning "This script will fully reset the Pretendo environment by **deleting all server data**. You will lose your \ +PNIDs, NEX accounts, Juxtaposition posts, Super Mario Maker courses, and anything else stored on the server!" +if [[ -z "$force" ]]; then + printf "Continue? [y/N] " + read -r continue + if [[ "$continue" != "Y" && "$continue" != "y" ]]; then + echo "Aborting." + exit 1 + fi +fi + +if [[ -z "$no_backup" ]]; then + "$git_base_dir/scripts/backup.sh" "pre_reset_$(date +%Y-%m-%dT%H.%M.%S)" +fi + +# Resetting stuff... +docker compose down --volumes +rm -f ./environment/*.local.env + +print_success "Reset complete. Run setup.sh to set up the environment again." +print_info "To restore the backup and undo the reset, use scripts/restore.sh with the backup directory starting with +\"pre_reset\" after running setup.sh." diff --git a/scripts/internal/framework.sh b/scripts/internal/framework.sh index 6e65d8d..985fa61 100644 --- a/scripts/internal/framework.sh +++ b/scripts/internal/framework.sh @@ -3,6 +3,7 @@ # Usage: # # shellcheck source=./internal/framework.sh # source "$(dirname "$(realpath "$0")")/internal/framework.sh" +# set_description "Script description goes here" # # Add options and arguments here # parse_arguments "$@"