diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-06-19 08:16:58 +0200 |
---|---|---|
committer | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2023-06-19 13:32:40 +0200 |
commit | 7d0b160531d66b0f8790f4034902904c7aa178bb (patch) | |
tree | 2e89e7d8b02a015a17fc00718ef17e6ba3e0ae74 /bin | |
parent | 32ee8d7b9cfaba032d8313e0fc01e4a92a199ad0 (diff) | |
download | debvm-7d0b160531d66b0f8790f4034902904c7aa178bb.tar.gz |
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.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/debvm-run | 13 |
1 files 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" "$@" |