From 5f4384d8128990f4e5904542ccf77f9386be6c5f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 11:29:55 +0000 Subject: [PATCH] feat: Remove existing images before cloning in install.sh - Check if aiosback and workspace already exist - Stop, terminate, and remove existing images before clone - Prevents 'File exists' error on re-installation --- cfg/install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cfg/install.sh b/cfg/install.sh index 86703e9..e20af6f 100644 --- a/cfg/install.sh +++ b/cfg/install.sh @@ -86,12 +86,25 @@ mkdir -p /root/.config/syui/ai echo "4. Enabling systemd-machined..." systemctl enable --now systemd-machined +# Remove existing images if they exist +echo "5. Checking for existing images..." +for img in $BACKUP workspace; do + if machinectl list-images | grep -q "^$img"; then + echo " Removing existing image: $img" + machinectl poweroff $img 2>/dev/null || true + sleep 1 + machinectl terminate $img 2>/dev/null || true + sleep 1 + machinectl remove $img + fi +done + # Create initial backup -echo "5. Creating initial backup image..." +echo "6. Creating initial backup image..." machinectl clone $NAME $BACKUP # Create workspace container for AI operations -echo "6. Creating workspace container..." +echo "7. Creating workspace container..." machinectl clone $NAME workspace echo ""