#!/bin/bash SOCKET="$HOME/.local/share/iridium-installer-vm/monitor.sock" SNAPSHOT_NAME="${1:-clean-state}" if [ ! -S "$SOCKET" ]; then echo "Error: QEMU monitor socket not found at $SOCKET" echo "Is the VM running?" exit 1 fi echo "Taking snapshot: $SNAPSHOT_NAME" echo "savevm $SNAPSHOT_NAME" | nc -U "$SOCKET" if [ $? -eq 0 ]; then echo "Snapshot command sent successfully." else echo "Failed to send snapshot command. Ensure 'nc' (netcat) with -U support is installed." fi