feat: add Scrub & Sanitize phase to setup script for reliable restarts
This commit is contained in:
@ -29,6 +29,27 @@ REAL_USER=${SUDO_USER:-$(logname)}
|
||||
REAL_HOME=$(eval echo "~$REAL_USER")
|
||||
echo "Target User: $REAL_USER ($REAL_HOME)"
|
||||
|
||||
# 0.5 SCRUB & SANITIZE PHASE
|
||||
echo "Scrubbing system for a clean installation..."
|
||||
systemctl stop mpvj-backend.service 2>/dev/null || true
|
||||
pkill -9 ofxPiMapper 2>/dev/null || true
|
||||
pkill -9 node 2>/dev/null || true
|
||||
|
||||
# Remove old setup artifacts
|
||||
swapoff /swapfile_mpvj 2>/dev/null || true
|
||||
rm -f /swapfile_mpvj 2>/dev/null || true
|
||||
|
||||
# Clear any stale apt locks
|
||||
rm -f /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock /var/cache/apt/archives/lock 2>/dev/null || true
|
||||
|
||||
# Ask to wipe previous data for a fresh start
|
||||
if [ -d "$REAL_HOME/mpvj" ] || [ -d "$REAL_HOME/openFrameworks" ]; then
|
||||
if whiptail --title "Cleanup" --yesno "Found existing MPVJ or OpenFrameworks data. Wipe them for a clean install?" 10 60 < /dev/tty; then
|
||||
echo "Wiping old directories..."
|
||||
rm -rf "$REAL_HOME/mpvj" "$REAL_HOME/openFrameworks"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. INTERROGATION PHASE
|
||||
echo "Interrogating user for configuration..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user