From 8582da238ecb63985ff808c61e5a9add4576d516 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 18 Jan 2026 11:22:00 -0600 Subject: Add boot-vm.sh convenience script Simple wrapper that boots from disk if installed, otherwise from ISO. Saves having to remember --boot-disk flag. --- scripts/boot-vm.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/boot-vm.sh (limited to 'scripts/boot-vm.sh') diff --git a/scripts/boot-vm.sh b/scripts/boot-vm.sh new file mode 100755 index 0000000..82922db --- /dev/null +++ b/scripts/boot-vm.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# boot-vm.sh - Boot the VM from disk if installed, otherwise from ISO +# +# This is a simple wrapper that does the right thing: +# - If VM disk exists and has data, boot from disk +# - Otherwise, boot from ISO + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +VM_DISK="$SCRIPT_DIR/../vm/archzfs-test.qcow2" + +if [[ -f "$VM_DISK" ]] && [[ $(stat -c%s "$VM_DISK") -gt 200000 ]]; then + # Disk exists and is larger than ~200KB (has been written to) + exec "$SCRIPT_DIR/test-vm.sh" --boot-disk "$@" +else + # No disk or empty disk - boot from ISO + exec "$SCRIPT_DIR/test-vm.sh" "$@" +fi -- cgit v1.2.3