From a6c1e4c8a52c6be27d590f890fe7a187d8401432 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 26 Jul 2026 23:55:50 +0200 Subject: [PATCH] feat: Added support for Reactos (#1999) --- readme.md | 7 ++++--- src/define.sh | 37 ++++++++++++++++++++++++++++++++++++- src/image.sh | 22 ++++++++++++++++++++-- src/install.sh | 31 +++++++++++++++++++++++++------ src/mido.sh | 18 ++++++++++++------ src/power.sh | 38 +++++++++++++++++++++++++++++--------- 6 files changed, 126 insertions(+), 27 deletions(-) diff --git a/readme.md b/readme.md index 90221407..88edb97c 100644 --- a/readme.md +++ b/readme.md @@ -134,9 +134,10 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas | `2008` | Windows Server 2008 | 3.0 GB | | `2003` | Windows Server 2003 | 0.6 GB | |||| - | `core11` | Tiny11 Core | 3.0 GB | - | `tiny11` | Tiny11 | 5.3 GB | - | `tiny10` | Tiny10 | 3.6 GB | + | `core11` | Tiny11 Core | 3.0 GB | + | `tiny11` | Tiny11 | 5.3 GB | + | `tiny10` | Tiny10 | 3.6 GB | + | `reactos` | Reactos | 0.03 GB | > [!TIP] > To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/). diff --git a/src/define.sh b/src/define.sh index 9e164617..7c11077d 100644 --- a/src/define.sh +++ b/src/define.sh @@ -67,7 +67,7 @@ SERVER_EDITION_ORDER=( "-hv|hv|hv hv-*" ) -MIRRORS=3 +MIRRORS=4 parseVersion() { @@ -184,6 +184,9 @@ parseVersion() { "tiny10" | "tiny 10" ) VERSION="tiny10" ;; + "reactos" | "react os" ) + VERSION="reactos" + ;; esac SUGGEST=$(getSuggestedVersion "$VERSION") @@ -483,6 +486,7 @@ printVersion() { "tiny11"* ) desc="Tiny 11" ;; "tiny10"* ) desc="Tiny 10" ;; "core11"* ) desc="Core 11" ;; + "reactos"* ) desc="Reactos" ;; "win7"* ) desc="Windows 7" ;; "win8"* ) desc="Windows 8" ;; "win10"* ) desc="Windows 10" ;; @@ -690,6 +694,8 @@ fromFile() { id="tiny11" ;; "tiny10"* | "tiny_10"* ) id="tiny10" ;; + "reactos"* ) + id="reactos" ;; *"_serverhypercore_"* ) id="win2019${add}-hv" ;; *"server2025"* | *"server_2025"* ) @@ -1299,6 +1305,35 @@ getLink2() { getLink3() { + local id="$1" + local lang="$2" + local ret="$3" + local url="" + local sum="" + local size="" + local host="https://iso.reactos.org" + + [[ "${lang,,}" != "en" && "${lang,,}" != "en-us" ]] && return 0 + + case "${id,,}" in + "reactos" ) + size=0 + sum="" + url="livecd/latest-x86-gcc-lin-rel" + ;; + esac + + case "${ret,,}" in + "sum" ) echo "$sum" ;; + "size" ) echo "$size" ;; + *) [ -n "$url" ] && echo "$host/$url";; + esac + + return 0 +} + +getLink4() { + local id="$1" local lang="$2" local ret="$3" diff --git a/src/image.sh b/src/image.sh index 526c584c..020ba786 100644 --- a/src/image.sh +++ b/src/image.sh @@ -510,7 +510,7 @@ skipVersion() { local id="$1" case "${id,,}" in - "win9"* | "winxp"* | "win2k"* | "win2003"* ) + "win9"* | "winxp"* | "win2k"* | "win2003"* | "reactos" ) return 0 ;; esac @@ -624,6 +624,24 @@ detectLegacy() { return 1 } +detectReactOS() { + + local dir="$1" + local marker + + marker=$(find "$dir" -maxdepth 2 -type f \ + \( \ + -ipath '*/reactos/reactos.inf' -o \ + -ipath '*/reactos/unattend.inf' \ + \) \ + -print -quit) || return 1 + + [ -n "$marker" ] || return 1 + + DETECTED="reactos" + return 0 +} + resolveImage() { local version="$1" @@ -821,7 +839,7 @@ detectImage() { info "Detecting version from ISO image..." - if detectLegacy "$dir"; then + if detectLegacy "$dir" || detectReactOS "$dir"; then desc=$(printEdition "$DETECTED" "$DETECTED" "Y") || return 1 info "Detected: $desc" return 0 diff --git a/src/install.sh b/src/install.sh index 2f0f9620..d2e0d93d 100644 --- a/src/install.sh +++ b/src/install.sh @@ -655,8 +655,8 @@ extractImage() { size=$(stat -c%s "$iso") - if (( size < 100000000 )); then - error "Invalid ISO file: Size is smaller than 100 MB" && return 1 + if (( size < 10000000 )); then + error "Invalid ISO file: Size is smaller than 10 MB" && return 1 fi checkFreeSpace "$dir" "$size" || return 1 @@ -684,15 +684,23 @@ extractImage() { file=$(find "$dir" -maxdepth 1 -type f -iname "*.iso" -print -quit) if [ -z "$file" ]; then - error "Failed to find any .iso file in archive!" && return 1 + error "Failed to find any .iso file in archive!" + return 1 fi if ! 7z x "$file" -o"$dir" > /dev/null; then - error "Failed to extract archive!" && return 1 + error "Failed to extract archive!" + return 1 fi LABEL=$(isoinfo -d -i "$file" | sed -n 's/Volume id: //p') || LABEL="" - rm -f "$file" || warn "Failed to remove temporary ISO file: $file" + + if ! mv -f -- "$file" "$iso"; then + error "Failed to preserve extracted ISO file: $file" + return 1 + fi + + UNPACK="" fi @@ -750,6 +758,16 @@ setMachine() { "winvista"* | "win7"* | "win2008"* ) BOOT_MODE="windows_legacy" ;; + "reactos" ) + VGA="cirrus" + MACHINE="pc" + REMOVE="N" + REBUILD="N" + USB="pci-ohci" + DISK_TYPE="auto" + BOOT_MODE="windows_legacy" + [ -z "${ADAPTER:-}" ] && ADAPTER="rtl8139" ;; + esac case "${id,,}" in @@ -763,7 +781,8 @@ setMachine() { case "${id,,}" in - "winxp"* | "win2003"* | "winvistax86"* | "win7x86"* | "win2008r2x86"* ) + "winxp"* | "win2003"* | "winvistax86"* | \ + "win7x86"* | "win2008r2x86"* | "reactos") if isQ35 "${MACHINE:-q35}"; then diff --git a/src/mido.sh b/src/mido.sh index 5aa2fed7..93efaf41 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -841,11 +841,13 @@ getESD() { isCompressed() { - local file="$1" + local url="${1%%\?*}" - case "${file,,}" in - *".7z" | *".zip" | *".rar" | *".lzma" | *".bz" | *".bz2" ) - return 0 ;; + case "${url,,}" in + *.7z | *.zip | *.rar | *.tar | *.cab | *.cpio | \ + *.lzh | *.lha | *.xar | */latest-x86-gcc-lin-rel ) + return 0 + ;; esac return 1 @@ -950,14 +952,18 @@ tryDownload() { local desc="$6" local seconds="$7" local web_desc="$8" - local total + local total minimum="104857600" + + if isCompressed "$url"; then + minimum="10485760" + fi if downloadRetry \ "$iso" \ "${CONNECTIONS:-1}" \ "$seconds" \ "$desc" \ - "100000000" \ + "$minimum" \ "$iso" \ "$url" \ "$size" \ diff --git a/src/power.sh b/src/power.sh index c3216225..7523d277 100644 --- a/src/power.sh +++ b/src/power.sh @@ -54,13 +54,23 @@ boot() { legacyBootReady() { - local last - local bios="Booting from Hard" + local line last recent + local hard="Booting from Hard" + local cdrom="Booting from DVD/CD" - last=$(grep "^Booting.*" "$QEMU_PTY" | tail -1) - [[ "${last,,}" != "${bios,,}"* ]] && return 1 - grep -Fq "No bootable device." "$QEMU_PTY" && return 1 - grep -Fq "BOOTMGR is missing" "$QEMU_PTY" && return 1 + line=$(grep -n "^Booting.*" "$QEMU_PTY" | tail -1) + [ -z "$line" ] && return 1 + + last="${line#*:}" + recent=$(tail -n +"${line%%:*}" "$QEMU_PTY") + + [[ "${last,,}" != "${hard,,}"* ]] && return 1 + + grep -Fq "Loading FreeLoader..." <<< "$recent" && return 0 + grep -Fq "No bootable device." <<< "$recent" && return 1 + grep -Fq "BOOTMGR is missing" <<< "$recent" && return 1 + grep -Fq "Boot failed: not a bootable disk" <<< "$recent" && return 1 + grep -Fq "Boot failed: could not read the boot disk" <<< "$recent" && return 1 return 0 } @@ -75,8 +85,14 @@ ready() { return 1 fi - local line="\"Windows Boot Manager\"" - grep -Fq "$line" "$QEMU_PTY" && return 0 + local last + last=$(grep -E \ + 'BdsDxe: starting Boot[[:xdigit:]]{4} ' \ + "$QEMU_PTY" | tail -1) + + grep -Eq \ + 'BdsDxe: starting Boot[[:xdigit:]]{4} "Windows Boot Manager" from HD\(' \ + <<< "$last" && return 0 return 1 } @@ -150,7 +166,11 @@ abortDuringSetup() { local code="$1" - info "Cannot send ACPI signal during $(app) setup, aborting..." + if [[ "${DETECTED,,}" != "reactos" ]] || [ -n "${CUSTOM:-}" ]; then + info "Cannot send ACPI signal during $(app) setup, aborting..." + else + info "ReactOS LiveCD does not support ACPI shutdown, terminating..." + fi terminateQemu