From 00857a7aaac1bb023e430bcc159744b82a92ebce Mon Sep 17 00:00:00 2001 From: Avimitin Lu Date: Thu, 15 Sep 2022 13:24:12 +0800 Subject: [PATCH] feat(startqemu): add argument parser for specifying different qcow image (#7) --- startqemu.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/startqemu.sh b/startqemu.sh index 7bf30fe..3c85a61 100755 --- a/startqemu.sh +++ b/startqemu.sh @@ -7,6 +7,14 @@ . /usr/share/makepkg/util.sh colorize +parse-args() { + local OPTIND=1 + shift "$(( OPTIND-1 ))" + file=${1:-archriscv-$(date --rfc-3339=date).qcow2} +} + +parse-args "$@" + msg "Starting qemu" qemu-system-riscv64 \ -nographic \ @@ -17,5 +25,5 @@ qemu-system-riscv64 \ -device virtio-blk-device,drive=hd0 \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-device,rng=rng0 \ - -drive file=archriscv-$(date --rfc-3339=date).qcow2,format=qcow2,id=hd0 \ + -drive file="$file",format=qcow2,id=hd0 \ -monitor unix:/tmp/qemu-monitor,server,nowait