+set_qemu() +{
- qemus=(
qemu-system-aarch64
qemu-kvm
qemu-system-x86_64
qemu-system-riscv64
- )
- for qemu in "${qemus[@]}"
- do
[ -n "$(command -v ${qemu})" ] && break
This looks a bit easier:
command -v "$qemu" >/dev/null && break
- done
The above/below logics are completely differnt logics. It looks the below one looks more reasonable.
How about first test qemu-system-$arch, then try qemu-kvm?
- # debian has both qemu-system-x86_64 and qemu-system-riscv64 command
- [[ $kernel =~ 'riscv64' ]] && qemu=qemu-system-riscv64
+}