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
This commit is contained in:
Claude
2025-11-07 11:29:55 +00:00
parent 74f6eea1a3
commit 5f4384d812

View File

@@ -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 ""