feat: add Scrub & Sanitize phase to setup script for reliable restarts

This commit is contained in:
Timothy Hofland
2026-03-11 10:41:50 +01:00
parent ec01ef4902
commit 04ca394b4b

View File

@ -29,6 +29,27 @@ REAL_USER=${SUDO_USER:-$(logname)}
REAL_HOME=$(eval echo "~$REAL_USER") REAL_HOME=$(eval echo "~$REAL_USER")
echo "Target User: $REAL_USER ($REAL_HOME)" 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 # 1. INTERROGATION PHASE
echo "Interrogating user for configuration..." echo "Interrogating user for configuration..."