From 16af657376aa20f7ac6ceeed373013ebe4f9a3e8 Mon Sep 17 00:00:00 2001 From: Dmitrii Date: Wed, 22 Apr 2026 09:44:08 -0400 Subject: [PATCH] feat: make uninstall prompts before wiping data Shows a warning then asks: y = full wipe, n/Enter = stop+remove images only (keep config/data), anything else = cancel. Updates help + README. Co-Authored-By: Claude Sonnet 4.6 --- Makefile | 28 +++++++++++++++++++++++----- README.md | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 77518a3..7ed261d 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ help: @echo "Updates & reinstall:" @echo " update - git pull + rebuild + restart (deploy latest code)" @echo " reinstall - Full wipe and fresh install from current git checkout" - @echo " uninstall - Remove containers, images, and all data (keeps git repo)" + @echo " uninstall - Stop + remove images; prompts whether to also wipe data" @echo "" @echo "Build:" @echo " build - Rebuild API image" @@ -133,10 +133,28 @@ reinstall: @echo "Reinstall complete." uninstall: - @echo "Uninstalling Personal Internet Cell..." - PUID=$$(id -u) PGID=$$(id -g) $(DC) down -v --rmi all 2>/dev/null || true - @sudo rm -rf config/ data/ - @echo "Uninstall complete. Git repo and scripts remain." + @echo "" + @echo "WARNING: This will stop all containers and remove all Docker images." + @echo "" + @printf "Also wipe all data and config? This cannot be undone. [y/N/cancel]: "; \ + read ans; \ + case "$$ans" in \ + y|Y) \ + echo "Stopping containers and removing images..."; \ + PUID=$$(id -u) PGID=$$(id -g) $(DC) down -v --rmi all 2>/dev/null || true; \ + echo "Wiping config/ and data/..."; \ + sudo rm -rf config/ data/; \ + echo "Uninstall complete. Git repo and scripts remain."; \ + ;; \ + n|N|"") \ + echo "Stopping containers and removing images (keeping data)..."; \ + PUID=$$(id -u) PGID=$$(id -g) $(DC) down --rmi all 2>/dev/null || true; \ + echo "Done. config/ and data/ are untouched. Run 'make setup && make start' to reinstall."; \ + ;; \ + *) \ + echo "Cancelled."; \ + ;; \ + esac # ── Build ───────────────────────────────────────────────────────────────────── diff --git a/README.md b/README.md index ff33199..d554176 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ make update # git pull + rebuild + restart make reinstall # stop, wipe config/data, setup, start fresh # Remove everything -make uninstall # stop containers, remove images and all data +make uninstall # stop + remove images; prompts whether to also wipe config/data # Maintenance make backup # tar config/ + data/ into backups/