+[ -z "$REPLY" ] && exit 0
+
+FILE=bootimage.raw
+[ $REPLY -ge 3 ] && FILE=${ISO}
+MEDIA=disk
+[ $REPLY -ge 5 ] && MEDIA=cdrom
+[ $REPLY -ge 7 ] && MEDIA=usb
+
+case "$MEDIA" in
+ disk)
+ DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
+ ;;
+ usb)
+ USB="
+ -device qemu-xhci,id=xhci
+ -drive if=none,id=stick,format=raw,media=disk,file=${FILE}
+ -device usb-storage,bus=xhci.0,port=1,drive=stick
+ "
+ ;;
+ cdrom*)
+ DISK2="-drive index=1,format=raw,media=$MEDIA,file=$FILE"
+ ;;
+esac
+
+BOOT="-boot menu=on,splash=boot.jpg,splash-time=60000"
+[ $(( $REPLY % 2 )) -eq 0 ] && BOOT="-bios /usr/share/OVMF/OVMF_CODE.fd"
+
+case "$NET" in
+ vde)
+ NET="-net nic,model=e1000 -net vde,sock=/run/vde.ctl"
+ ;;
+ *)
+ NET=
+ ;;
+esac
+
+[ -e disk.raw ] || dd if=/dev/zero of=disk.raw bs=1G count=0 seek=8
+