feat(startqemu): add argument parser for specifying different qcow image (#7)

This commit is contained in:
Avimitin Lu 2022-09-15 13:24:12 +08:00 committed by GitHub
parent 218dcea615
commit 00857a7aaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,14 @@
. /usr/share/makepkg/util.sh . /usr/share/makepkg/util.sh
colorize colorize
parse-args() {
local OPTIND=1
shift "$(( OPTIND-1 ))"
file=${1:-archriscv-$(date --rfc-3339=date).qcow2}
}
parse-args "$@"
msg "Starting qemu" msg "Starting qemu"
qemu-system-riscv64 \ qemu-system-riscv64 \
-nographic \ -nographic \
@ -17,5 +25,5 @@ qemu-system-riscv64 \
-device virtio-blk-device,drive=hd0 \ -device virtio-blk-device,drive=hd0 \
-object rng-random,filename=/dev/urandom,id=rng0 \ -object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=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 -monitor unix:/tmp/qemu-monitor,server,nowait