From 7d0b160531d66b0f8790f4034902904c7aa178bb Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 19 Jun 2023 08:16:58 +0200 Subject: debvm-run: replace shell process with qemu process We need the intermediate shell process to clean the temporary files with the kernel and the initrd - unless we delete them before running qemu. This method should help with killing a qemu e.g. using a timeout. --- bin/debvm-run | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/debvm-run b/bin/debvm-run index 759ab27..03cde3b 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -246,12 +246,18 @@ esac KERNEL_CMDLINE="root=LABEL=$IMAGE_LABEL rw" NETDEV="user,id=net0" +exec 8<"$KERNELTMP" +exec 9<"$INITRDTMP" +rm -f "$KERNELTMP" "$INITRDTMP" +KERNELTMP= +INITRDTMP= + set -- \ -no-user-config \ -name "debvm-run $IMAGE" \ -m 1G \ - -kernel "$KERNELTMP" \ - -initrd "$INITRDTMP" \ + -kernel "/proc/self/fd/8" \ + -initrd "/proc/self/fd/9" \ -drive "media=disk,format=raw,discard=unmap,file=$IMAGE,if=virtio,cache=unsafe" \ -object rng-random,filename=/dev/urandom,id=rng0 \ "$@" @@ -390,4 +396,5 @@ set -- \ -device "$NIC_DEV" \ "$@" -with_set_ex "$QEMU" "$@" +echo + "$QEMU" "$@" +exec "$QEMU" "$@" -- cgit v1.2.3