detached 941cbeb

refactor(vm): share QEMU profile builder in ISO launcher

commit
941cbebda5fafa2ac2b74b0c2d3c5d4777cffa7f
author
brice · · 2026-02-27 04:45 UTC
parent
1501418
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +29 -22
M test/vm/start-qemu-arch-iso.sh +29 -22
@@ -1,32 +1,39 @@
11 #!/bin/bash
2-# Start Arch ISO in QEMU with UEFI support and SSH access
2+# Start Arch ISO in QEMU with realistic hardware profile
3+# Usage: ./start-qemu-arch-iso.sh [--profile desktop|laptop] [--secure-boot on|off] [--ssh-port PORT]
4+set -euo pipefail
35
4-set -e
5-
6-# Get test directory
76 TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
87 ISO_FILE="$TEST_DIR/archlinux-x86_64.iso"
98 ISO_URL="https://geo.mirror.pkgbuild.com/iso/latest/archlinux-x86_64.iso"
109
11-# Download latest Arch ISO if not present
10+PROFILE="desktop"
11+SECURE_BOOT="off"
12+SSH_PORT="2222"
13+
14+while [[ $# -gt 0 ]]; do
15+ case "$1" in
16+ --profile) PROFILE="$2"; shift 2 ;;
17+ --secure-boot) SECURE_BOOT="$2"; shift 2 ;;
18+ --ssh-port) SSH_PORT="$2"; shift 2 ;;
19+ *) echo "Unknown flag: $1"; exit 1 ;;
20+ esac
21+done
22+
1223 if [[ ! -f "$ISO_FILE" ]]; then
13- echo "Arch Linux ISO not found in $TEST_DIR"
14- echo "Downloading latest Arch ISO from $ISO_URL..."
15- curl -L -o "$ISO_FILE" "$ISO_URL"
16- echo "Download complete!"
24+ echo "Arch Linux ISO not found in $TEST_DIR"
25+ echo "Downloading latest Arch ISO from $ISO_URL..."
26+ curl -L -o "$ISO_FILE" "$ISO_URL"
27+ echo "Download complete!"
1728 else
18- echo "Using existing ISO: $ISO_FILE"
29+ echo "Using existing ISO: $ISO_FILE"
1930 fi
2031
21-qemu-system-x86_64 \
22- -enable-kvm \
23- -m 2048 \
24- -smp 2 \
25- -bios /usr/share/edk2/x64/OVMF.4m.fd \
26- -boot d \
27- -cdrom "$ISO_FILE" \
28- -drive file="$TEST_DIR/arch-test.qcow2",format=qcow2,if=virtio \
29- -display gtk \
30- -vga virtio \
31- -net nic,model=virtio \
32- -net user,hostfwd=tcp::2222-:22
32+source "$TEST_DIR/lib/qemu-profile.sh"
33+build_qemu_args "$PROFILE" "$SECURE_BOOT" "$SSH_PORT" "$TEST_DIR"
34+
35+# ISO boot additions
36+QEMU_ARGS+=(-boot d)
37+QEMU_ARGS+=(-cdrom "$ISO_FILE")
38+
39+exec qemu-system-x86_64 "${QEMU_ARGS[@]}"
@@ -1,32 +1,39 @@
1 #!/bin/bash1 #!/bin/bash
2-# Start Arch ISO in QEMU with UEFI support and SSH access2+# Start Arch ISO in QEMU with realistic hardware profile
3+# Usage: ./start-qemu-arch-iso.sh [--profile desktop|laptop] [--secure-boot on|off] [--ssh-port PORT]
4+set -euo pipefail
3 5
4-set -e
5-
6-# Get test directory
7 TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"6 TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8 ISO_FILE="$TEST_DIR/archlinux-x86_64.iso"7 ISO_FILE="$TEST_DIR/archlinux-x86_64.iso"
9 ISO_URL="https://geo.mirror.pkgbuild.com/iso/latest/archlinux-x86_64.iso"8 ISO_URL="https://geo.mirror.pkgbuild.com/iso/latest/archlinux-x86_64.iso"
10 9
11-# Download latest Arch ISO if not present10+PROFILE="desktop"
11+SECURE_BOOT="off"
12+SSH_PORT="2222"
13+
14+while [[ $# -gt 0 ]]; do
15+ case "$1" in
16+ --profile) PROFILE="$2"; shift 2 ;;
17+ --secure-boot) SECURE_BOOT="$2"; shift 2 ;;
18+ --ssh-port) SSH_PORT="$2"; shift 2 ;;
19+ *) echo "Unknown flag: $1"; exit 1 ;;
20+ esac
21+done
22+
12 if [[ ! -f "$ISO_FILE" ]]; then23 if [[ ! -f "$ISO_FILE" ]]; then
13- echo "Arch Linux ISO not found in $TEST_DIR"24+ echo "Arch Linux ISO not found in $TEST_DIR"
14- echo "Downloading latest Arch ISO from $ISO_URL..."25+ echo "Downloading latest Arch ISO from $ISO_URL..."
15- curl -L -o "$ISO_FILE" "$ISO_URL"26+ curl -L -o "$ISO_FILE" "$ISO_URL"
16- echo "Download complete!"27+ echo "Download complete!"
17 else28 else
18- echo "Using existing ISO: $ISO_FILE"29+ echo "Using existing ISO: $ISO_FILE"
19 fi30 fi
20 31
21-qemu-system-x86_64 \32+source "$TEST_DIR/lib/qemu-profile.sh"
22- -enable-kvm \33+build_qemu_args "$PROFILE" "$SECURE_BOOT" "$SSH_PORT" "$TEST_DIR"
23- -m 2048 \34+
24- -smp 2 \35+# ISO boot additions
25- -bios /usr/share/edk2/x64/OVMF.4m.fd \36+QEMU_ARGS+=(-boot d)
26- -boot d \37+QEMU_ARGS+=(-cdrom "$ISO_FILE")
27- -cdrom "$ISO_FILE" \38+
28- -drive file="$TEST_DIR/arch-test.qcow2",format=qcow2,if=virtio \39+exec qemu-system-x86_64 "${QEMU_ARGS[@]}"
29- -display gtk \
30- -vga virtio \
31- -net nic,model=virtio \
32- -net user,hostfwd=tcp::2222-:22

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close