Skip to content

Commit ed80682

Browse files
fix(dev): recycle the test VM in the local test-install-vm recipe (#243)
iso-test-vm / the GUI 'Test install in VM' button call this dev recipe, which delegates to the shipped 'ujust margine-test-vm'. That base recipe only learns to recycle after a base update (PR #239), so until then a re-run dead-ends on 'a VM named margine-test-Margine-Live already exists'. Tear down the stale same-named qemu:///session VM (domain + disk + nvram) here first, so the local iterate loop self-heals immediately — no base update required. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c6e558f commit ed80682

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Justfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,21 @@ test-install-vm:
255255
echo " $ISO_ABS"
256256
echo "Install with the DEFAULT partitioning; the INSTALLED system's first boot"
257257
echo "prompts MokManager for Secure Boot (passphrase: margine-os)."
258+
# Recycle here too, so a re-run never dead-ends on "a VM named X already
259+
# exists". The shipped `ujust margine-test-vm` only learns to recycle after a
260+
# base update (PR #239); this dev recipe (what `iso-test-vm` / the GUI button
261+
# call) must self-heal NOW. Derive the same name the base recipe does and tear
262+
# down any stale same-named session VM (domain + disk + nvram) first.
263+
NAME="margine-test-$(basename "$ISO_ABS" .iso)"
264+
NAME="$(printf '%s' "$NAME" | tr -c 'a-zA-Z0-9._-' '-')"
265+
CONN="qemu:///session"
266+
if virsh -c "$CONN" dominfo "$NAME" >/dev/null 2>&1; then
267+
echo "Recreating throwaway VM '$NAME' (removing the previous domain + disk)…"
268+
virsh -c "$CONN" destroy "$NAME" >/dev/null 2>&1 || true
269+
virsh -c "$CONN" undefine "$NAME" --nvram --remove-all-storage >/dev/null 2>&1 \
270+
|| virsh -c "$CONN" undefine "$NAME" --nvram >/dev/null 2>&1 \
271+
|| virsh -c "$CONN" undefine "$NAME" >/dev/null 2>&1 || true
272+
fi
258273
exec ujust margine-test-vm "$ISO_ABS"
259274
260275
# Launch the GTK4 GUI that drives the local ISO builds (dev tool, not shipped).

0 commit comments

Comments
 (0)