shift
# determine ssh forward port
ssh_port=22000
-while echo '' | nc localhost $ssh_port >/dev/null; do
+until echo '' | nc localhost $ssh_port 2>&1 >/dev/null | grep -q 'Connection refused'; do
ssh_port=$((ssh_port+1))
done
echo "Host ssh port: $ssh_port"
qemu-system-x86_64 -enable-kvm -display sdl -m 2048 -device virtio-rng-pci \
-drive file="$image",if=virtio \
- -virtfs local,id=src,path=$HOME,security_model=none,mount_tag=home,readonly \
+ -virtfs local,id=src,path=$HOME,security_model=none,mount_tag=home,readonly=on \
-net nic,model=virtio -net user,hostfwd=tcp::${ssh_port}-:22 "$@"