From 4eff9d7e22fd9237f0068ef1ecea44ddf4c2a26f Mon Sep 17 00:00:00 2001 From: N0VA Date: Thu, 5 Feb 2026 14:18:39 +0100 Subject: [PATCH] Update UEFI VM script with correct paths and add snapshot script --- run_vm_uefi.sh | 40 ++++++++++++++++++++++++++++++++++++++++ take_snapshot.sh | 19 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 run_vm_uefi.sh create mode 100755 take_snapshot.sh diff --git a/run_vm_uefi.sh b/run_vm_uefi.sh new file mode 100755 index 0000000..6f3b8ac --- /dev/null +++ b/run_vm_uefi.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Configuration +ISO_PATH="${1:-/home/n0va/Downloads/Fedora-Workstation-Live-43-1.6.x86_64.iso}" +DISK_PATH="${2:-/home/n0va/.local/share/iridium-installer-vm/test-disk.qcow2}" +OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd" +OVMF_VARS_TEMPLATE="/usr/share/edk2/x64/OVMF_VARS.4m.fd" +OVMF_VARS_LOCAL="/tmp/iridium_vm_vars.fd" + +# Ensure OVMF vars exist +if [ ! -f "$OVMF_VARS_LOCAL" ]; then + if [ -f "$OVMF_VARS_TEMPLATE" ]; then + cp "$OVMF_VARS_TEMPLATE" "$OVMF_VARS_LOCAL" + else + echo "Warning: OVMF VARS template not found at $OVMF_VARS_TEMPLATE" + fi +fi + +echo "Starting Iridium VM with UEFI support..." +echo "ISO: $ISO_PATH" +echo "Disk: $DISK_PATH" + +# QEMU Command with UEFI (OVMF) enabled +qemu-system-x86_64 \ + -enable-kvm \ + -m 4G \ + -smp 2 \ + -cpu host \ + -drive if=pflash,format=raw,readonly=on,file="$OVMF_CODE" \ + -drive if=pflash,format=raw,file="$OVMF_VARS_LOCAL" \ + -drive file="$DISK_PATH",format=qcow2,if=virtio \ + -cdrom "$ISO_PATH" \ + -boot once=d \ + -netdev user,id=net0 \ + -device virtio-net-pci,netdev=net0 \ + -vga virtio \ + -display gtk,gl=on \ + -monitor unix:$HOME/.local/share/iridium-installer-vm/monitor.sock,server,nowait \ + -name "Iridium Installer Test VM (UEFI)" \ +# -loadvm clean-state \ No newline at end of file diff --git a/take_snapshot.sh b/take_snapshot.sh new file mode 100755 index 0000000..9b83c81 --- /dev/null +++ b/take_snapshot.sh @@ -0,0 +1,19 @@ +#!/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