Files
installer/run_vm_bios.sh

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# 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
# 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 \
-smp 2 \
-cpu host \
-drive file="$DISK_PATH",format=qcow2,if=virtio \
-device virtio-scsi-pci,id=scsi0 \
-drive file="$ISO_PATH",format=raw,if=none,id=cdrom,readonly=on \
-device scsi-cd,bus=scsi0.0,drive=cdrom \
-boot order=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 (BIOS)" \
$LOADVM_ARG