4 [ -e "$image" ] || { echo "Usage: $0 <image> [options...]" >&2; exit 1; }
6 # determine ssh forward port
8 until echo '' | nc localhost $ssh_port 2>&1 >/dev/null | grep -q 'Connection refused'; do
9 ssh_port=$((ssh_port+1))
11 echo "Host ssh port: $ssh_port"
12 qemu-system-x86_64 -enable-kvm -display sdl -m 2048 -device virtio-rng-pci \
13 -drive file="$image",if=virtio \
14 -virtfs local,id=src,path=$HOME,security_model=none,mount_tag=home,readonly=on \
15 -net nic,model=virtio -net user,hostfwd=tcp::${ssh_port}-:22 "$@"