2019-02-20 22:10:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2021-10-31 12:07:59 +00:00
|
|
|
set --
|
2021-11-14 13:19:15 +00:00
|
|
|
set -- "$@" -machine pc -smp "${VM_CPU:?}" -m "${VM_RAM:?}"
|
2021-11-20 13:15:49 +00:00
|
|
|
set -- "$@" -device VGA -display vnc=:0 -serial stdio -monitor unix:/run/qemu-monitor,server,nowait
|
2022-06-18 12:09:44 +00:00
|
|
|
set -- "$@" -device e1000,netdev=n0 -netdev user,id=n0,ipv4=on,ipv6=off,net=10.0.2.0/24,host=10.0.2.2,dns=10.0.2.3,dhcpstart=10.0.2.15,hostfwd=tcp::2323-:23,hostfwd=tcp::5151-:51,hostfwd=tcp::3389-:3389,"${VM_NET_EXTRA_OPTIONS?}"
|
2021-11-21 11:20:36 +00:00
|
|
|
set -- "$@" -device ide-hd,id=disk0,bus=ide.0,drive=disk0 -blockdev driver=qcow2,node-name=disk0,file.driver=file,file.filename=/var/lib/qemu/disk/reactos.qcow2
|
2021-11-20 13:15:49 +00:00
|
|
|
set -- "$@" -usb -device usb-tablet
|
|
|
|
set -- "$@" -k "${VM_KEYBOARD:?}"
|
2021-08-02 19:23:21 +00:00
|
|
|
|
2021-10-31 12:07:59 +00:00
|
|
|
if [ "${VM_KVM:?}" = true ] && [ -c /dev/kvm ]; then
|
2021-11-15 18:51:53 +00:00
|
|
|
set -- "$@" -accel kvm -cpu host
|
2021-10-31 12:07:59 +00:00
|
|
|
else
|
|
|
|
set -- "$@" -accel tcg
|
2021-08-02 19:23:21 +00:00
|
|
|
fi
|
2019-02-20 22:10:38 +00:00
|
|
|
|
2021-11-20 13:15:49 +00:00
|
|
|
cd_i=0
|
|
|
|
for cd in /var/lib/qemu/cd/*; do
|
|
|
|
[ -f "${cd:?}" ] || continue
|
2021-11-21 11:20:36 +00:00
|
|
|
set -- "$@" -device ide-cd,id=cd"${cd_i:?}",bus=ide.1,drive=cd"${cd_i:?}" -blockdev driver=raw,node-name=cd"${cd_i:?}",file.driver=file,file.filename="${cd:?}",read-only=on
|
2021-11-20 13:15:49 +00:00
|
|
|
cd_i="$((cd_i + 1))"
|
2021-11-14 13:08:28 +00:00
|
|
|
done
|
|
|
|
|
2021-11-20 13:15:49 +00:00
|
|
|
floppy_i=0
|
|
|
|
for floppy in /var/lib/qemu/floppy/*; do
|
|
|
|
[ -f "${floppy:?}" ] || continue
|
2021-11-21 11:20:36 +00:00
|
|
|
set -- "$@" -device floppy,id=floppy"${floppy_i:?}",bus=floppy-bus.0,drive=floppy"${floppy_i:?}" -blockdev driver=raw,node-name=floppy"${floppy_i:?}",file.driver=file,file.filename="${floppy:?}",read-only=on
|
2021-11-20 13:15:49 +00:00
|
|
|
floppy_i="$((floppy_i + 1))"
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "${cd_i:?}" -gt 0 ]; then
|
2021-11-14 13:08:28 +00:00
|
|
|
set -- "$@" -boot order=dc,menu=on,splash-time=5000
|
|
|
|
fi
|
|
|
|
|
2019-09-15 18:55:14 +00:00
|
|
|
cd /var/lib/qemu/
|
2019-02-20 22:10:38 +00:00
|
|
|
exec 2>&1
|
2021-10-31 12:07:59 +00:00
|
|
|
exec /usr/bin/qemu-system-x86_64 "$@"
|