From e8afc31d0021d849d389463cf1e0023d53d0c3b3 Mon Sep 17 00:00:00 2001 From: N0VA Date: Mon, 9 Feb 2026 15:14:09 +0100 Subject: [PATCH] Enable snapshot support in run_vm_bios.sh with automatic detection --- run_vm_bios.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/run_vm_bios.sh b/run_vm_bios.sh index d10af1a..886c874 100755 --- a/run_vm_bios.sh +++ b/run_vm_bios.sh @@ -3,18 +3,34 @@ # Configuration ISO_PATH="${1:-/home/n0va/.local/share/iridium-installer-vm/Fedora.iso}" DISK_PATH="${2:-/home/n0va/.local/share/iridium-installer-vm/test-disk.qcow2}" +SNAPSHOT_NAME="clean-state" if [ ! -f "$ISO_PATH" ]; then echo "Error: ISO not found at $ISO_PATH" exit 1 fi +if [ ! -f "$DISK_PATH" ]; then + echo "Error: Disk image not found at $DISK_PATH" + exit 1 +fi + echo "Starting Iridium VM with BIOS (Legacy) support..." echo "ISO: $ISO_PATH" echo "Disk: $DISK_PATH" +# Check if snapshot exists +LOADVM_ARG="" +if qemu-img info "$DISK_PATH" | grep -q " $SNAPSHOT_NAME$"; then + echo "Found snapshot '$SNAPSHOT_NAME', loading..." + LOADVM_ARG="-loadvm $SNAPSHOT_NAME" +else + echo "Snapshot '$SNAPSHOT_NAME' not found. Starting from fresh disk state." +fi + # QEMU Command with BIOS -# Using -device ide-cd for better compatibility in some environments +# Note: For snapshots to work reliably, all writable disks must be qcow2. +# The ISO is raw but readonly=on, which is compatible. qemu-system-x86_64 \ -enable-kvm \ -m 8G \ @@ -30,4 +46,5 @@ qemu-system-x86_64 \ -vga virtio \ -display gtk,gl=on \ -monitor unix:$HOME/.local/share/iridium-installer-vm/monitor.sock,server,nowait \ - -name "Iridium Installer Test VM (BIOS)" + -name "Iridium Installer Test VM (BIOS)" \ + $LOADVM_ARG \ No newline at end of file