From 8e86d9dcae30ee87730beecd79dcd66d2acf8f6d Mon Sep 17 00:00:00 2001 From: Lars Karlitski Date: Mon, 23 Nov 2020 20:04:19 +0100 Subject: [PATCH] tools/deploy-qemu: allow passing extra args to qemu This is a developer tool. Allowing setting QEMU_EXTRA_ARGS so that developers can add arguments that make sense on their machines and for their workflows. --- tools/deploy-qemu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/deploy-qemu b/tools/deploy-qemu index b64155acd..7866337a3 100755 --- a/tools/deploy-qemu +++ b/tools/deploy-qemu @@ -12,6 +12,8 @@ # USERDATA -- A cloud-init user-data config file, or a directory of # configuration as accepted by the `gen-user-data` tool. # +# In addition, if the QEMU_EXTRA_ARGS environment variable is defined, it adds +# its content as additional arguments to qemu. set -euo pipefail @@ -23,6 +25,7 @@ fi scriptdir=$(dirname "$0") image=$1 userdata=$2 +read -ra qemu_extra_args <<< "${QEMU_EXTRA_ARGS:-}" workdir=$(mktemp -d "$scriptdir/qemu-tmp-XXXXXX") function cleanup() { rm -rf "$workdir" @@ -67,4 +70,4 @@ qemu-system-x86_64 \ -net nic,model=virtio \ -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::4430-:443 \ -cdrom "$workdir/cloudinit.iso" \ - "$image" + "${qemu_extra_args[@]}" "$image"