training-academy/reset-to-fresh.sh

68 lines
2.0 KiB
Bash

#!/bin/bash
# ==============================================================================
# Reset Gooner Training Academy to Fresh Install
# macOS/Linux Shell Script
# ==============================================================================
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo ""
echo "========================================================================"
echo " Gooner Training Academy - Fresh Install Reset"
echo "========================================================================"
echo ""
echo -e "${YELLOW}This will DELETE ALL local data including settings and progress.${NC}"
echo -e "${RED}This action CANNOT be undone!${NC}"
echo ""
# Prompt for confirmation
read -p "Are you sure you want to continue? (yes/no): " -r
echo ""
if [[ ! $REPLY =~ ^[Yy][Ee][Ss]$ ]]
then
echo -e "${GREEN}Reset cancelled. No changes were made.${NC}"
exit 0
fi
echo "Starting reset process..."
echo ""
# Close any running Electron instances
echo "[1/2] Closing running instances..."
pkill -f "electron" 2>/dev/null
pkill -f "Electron" 2>/dev/null
sleep 2
# Clear Electron userData directory
echo "[2/2] Clearing Electron user data..."
# Determine the userData path based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
USERDATA_PATH="$HOME/Library/Application Support/webGame"
else
# Linux
USERDATA_PATH="$HOME/.config/webGame"
fi
if [ -d "$USERDATA_PATH" ]; then
echo "Deleting: $USERDATA_PATH"
rm -rf "$USERDATA_PATH"
echo "Deleted Electron user data directory"
else
echo "User data directory not found (this is normal for first run)"
fi
echo ""
echo "========================================================================"
echo -e "${GREEN} Reset Complete!${NC}"
echo "========================================================================"
echo ""
echo "All settings and progress have been cleared."
echo "Next time you run 'npm start', it will be like a fresh install."
echo ""