Add reactos (#423)

* Add initial support for ReactOS

* Move code block to be able to override default cdrom settings
This commit is contained in:
Mikael Bak 2022-08-18 10:44:09 +02:00 committed by GitHub
parent 52f298ba8b
commit 600ada52ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 15 deletions

View File

@ -509,6 +509,14 @@ function vm_boot() {
MACHINE_TYPE="pc"
NET_DEVICE="rtl8139"
;;
reactos)
CPU="-cpu qemu32,kvm=on"
if [ "${HOST_CPU_VENDOR}" == "AuthenticAMD" ]; then
CPU="${CPU},topoext"
fi
MACHINE_TYPE="pc"
NET_DEVICE="e1000"
;;
macos)
#https://www.nicksherlock.com/2020/06/installing-macos-big-sur-on-proxmox/
# A CPU with SSE4.1 support is required for >= macOS Sierra
@ -1003,6 +1011,27 @@ function vm_boot() {
-drive if=pflash,format=raw,unit=1,file="${EFI_VARS}")
fi
if [ -n "${iso}" ] && [ "${guest_os}" == "freedos" ]; then
# FreeDOS reboots after partitioning the disk, and QEMU tries to boot from disk after first restart
# This flag sets the boot order to cdrom,disk. It will persist until powering down the VM
args+=(-boot order=dc)
elif [ -n "${iso}" ] && [ "${guest_os}" == "kolibrios" ]; then
# Since there is bug (probably) in KolibriOS: cdrom indexes 0 or 1 make system show an extra unexisting iso, so we use index=2
# shellcheck disable=SC2054
args+=(-drive media=cdrom,index=2,file="${iso}")
iso=""
elif [ -n "${iso}" ] && [ "${guest_os}" == "reactos" ]; then
# shellcheck disable=SC2054
# https://reactos.org/wiki/QEMU
args+=(-boot order=d
-drive if=ide,index=2,media=cdrom,file="${iso}")
iso=""
elif [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then
# Attach the unattended configuration to Windows guests when booting from ISO
# shellcheck disable=SC2054
args+=(-drive media=cdrom,index=2,file="${VMDIR}/unattended.iso")
fi
if [ -n "${floppy}" ]; then
# shellcheck disable=SC2054
args+=(-drive if=floppy,format=raw,file="${floppy}")
@ -1018,21 +1047,6 @@ function vm_boot() {
args+=(-drive media=cdrom,index=1,file="${fixed_iso}")
fi
if [ -n "${iso}" ] && [ "${guest_os}" == "freedos" ]; then
# FreeDOS reboots after partitioning the disk, and QEMU tries to boot from disk after first restart
# This flag sets the boot order to cdrom,disk. It will persist until powering down the VM
args+=(-boot order=dc)
elif [ -n "${iso}" ] && [ "${guest_os}" == "kolibrios" ]; then
# Since there is bug (probably) in KolibriOS: cdrom indexes 0 or 1 make system show an extra unexisting iso, so we use index=2
# shellcheck disable=SC2054
args+=(-drive media=cdrom,index=2,file="${iso}")
iso=""
elif [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then
# Attach the unattended configuration to Windows guests when booting from ISO
# shellcheck disable=SC2054
args+=(-drive media=cdrom,index=2,file="${VMDIR}/unattended.iso")
fi
if [ "${guest_os}" == "macos" ]; then
# shellcheck disable=SC2054
args+=(-device ahci,id=ahci
@ -1053,12 +1067,19 @@ function vm_boot() {
args+=(-device ahci,id=ahci
-device ide-hd,bus=ahci.0,drive=SystemDisk
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
elif [ "${guest_os}" == "batocera" ] ; then
# shellcheck disable=SC2054,SC2206
args+=(-device virtio-blk-pci,drive=BootDisk
-drive id=BootDisk,if=none,format=raw,file="${img}"
-device virtio-blk-pci,drive=SystemDisk
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
elif [ "${guest_os}" == "reactos" ]; then
# shellcheck disable=SC2054,SC2206
# https://reactos.org/wiki/QEMU
args+=(-drive if=ide,index=0,media=disk,file="${disk_img}")
else
# shellcheck disable=SC2054,SC2206
args+=(-device virtio-blk-pci,drive=SystemDisk

View File

@ -57,6 +57,7 @@ function pretty_name() {
opensuse) PRETTY_NAME="openSUSE";;
oraclelinux) PRETTY_NAME="Oracle Linux";;
popos) PRETTY_NAME="Pop!_OS";;
reactos) PRETTY_NAME="ReactOS";;
regolith) PRETTY_NAME="Regolith Linux";;
rockylinux) PRETTY_NAME="Rocky Linux";;
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";;
@ -196,6 +197,7 @@ function os_support() {
opensuse \
oraclelinux \
popos \
reactos \
regolith \
rockylinux \
slackware \
@ -437,6 +439,10 @@ function editions_popos() {
echo intel nvidia
}
function releases_reactos() {
echo latest
}
function releases_regolith() {
echo focal impish
}
@ -719,6 +725,9 @@ function make_vm_config() {
openbsd)
GUEST="openbsd"
IMAGE_TYPE="iso";;
reactos)
GUEST="reactos"
IMAGE_TYPE="iso";;
windows)
GUEST="windows"
IMAGE_TYPE="iso";;
@ -765,6 +774,11 @@ EOF
echo "disk_size=\"2G\"" >> "${CONF_FILE}"
echo "ram=\"128M\"" >> "${CONF_FILE}"
;;
reactos)
echo "boot=\"legacy\"" >> "${CONF_FILE}"
echo "disk_size=\"12G\"" >> "${CONF_FILE}"
echo "ram=\"2048M\"" >> "${CONF_FILE}"
;;
macos) echo "macos_release=\"${RELEASE}\"" >> "${CONF_FILE}";;
esac
@ -1307,6 +1321,16 @@ function get_popos() {
echo "${URL} ${HASH}"
}
function get_reactos() {
local HASH=""
local URL=""
local TMPURL=""
TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/reactos/files/latest/download" 2>&1 | grep Location | cut -d' ' -f4)
URL=${TMPURL%\?*}
echo "${URL} ${HASH}"
}
function get_regolith() {
local EDITION="${1:-}"
local HASH=""
@ -1843,6 +1867,11 @@ create_vm() {
ISO="${ISO/.gz/}"
fi
if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip')
fi
make_vm_config "${ISO}"
}