diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-18 11:22:00 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-18 11:22:00 -0600 |
| commit | 8582da238ecb63985ff808c61e5a9add4576d516 (patch) | |
| tree | 3528de1d4ab085f7ed98cc10e29f81f37bf31fa4 | |
| parent | 2e8e5cdd980098241fbd5f6d92f05111818f574a (diff) | |
| download | archangel-8582da238ecb63985ff808c61e5a9add4576d516.tar.gz archangel-8582da238ecb63985ff808c61e5a9add4576d516.zip | |
Add boot-vm.sh convenience script
Simple wrapper that boots from disk if installed, otherwise from ISO.
Saves having to remember --boot-disk flag.
| -rwxr-xr-x | scripts/boot-vm.sh | 17 |
1 files changed, 17 insertions, 0 deletions
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 |
