1
0
mirror of https://github.com/dockur/windows.git synced 2026-07-27 21:42:36 +07:00

Compare commits

...

16 Commits

Author SHA1 Message Date
Kroese b38b7b0953 docs: Added new DISK_OPTIONS variable (#2006) 2026-07-27 11:47:06 +02:00
Kroese 0fdab89516 feat: Disable autoreboot for Windows 2000 and 2003 (#2005) 2026-07-27 11:24:55 +02:00
Kroese 2488d5735b feat: Disable auto reboot on XP (#2004) 2026-07-27 03:35:38 +02:00
Kroese aa7ddb698c fix: Disable modern VirtIO for Windows XP on Q35 (#2003) 2026-07-27 02:42:42 +02:00
Kroese 5eba2a5fed feat: Keep Windows XP blue screens visible in debug mode (#2002) 2026-07-27 02:20:17 +02:00
Kroese ee97b9d628 fix: Exclude some warning in blinter (#2001) 2026-07-27 01:02:04 +02:00
Kroese c36c36ca00 fix: Do not override defined variables in setMachine (#2000) 2026-07-27 00:48:24 +02:00
Kroese a6c1e4c8a5 feat: Added support for Reactos (#1999) 2026-07-26 23:55:50 +02:00
Kroese 5287b0ba85 fix: Detect IA32-only EFI media as legacy (#1998) 2026-07-26 21:06:40 +02:00
Kroese f6fcb46958 build: Update workflows (#1996) 2026-07-26 20:37:20 +02:00
Kroese 4fdc3f0428 docs: List Tiny versions (#1997) 2026-07-26 20:36:28 +02:00
Kroese 16f763912b fix: Use qemu32 for Vista x86 and Win7 x86 (#1995) 2026-07-26 19:44:18 +02:00
Kroese e00d1aead1 fix: Use qemu32 for x86 Windows versions (#1994) 2026-07-26 18:09:58 +02:00
Kroese 78ba661605 fix: Default to IDE disk for 32-bit WinXP versions (#1993) 2026-07-26 17:43:59 +02:00
Kroese bada80331d fix: Derive NT5 boot load size from extracted image (#1991) 2026-07-26 08:34:21 +02:00
Kroese c589e1be18 fix: Extract legacy boot images using virtual sectors (#1990) 2026-07-26 08:02:28 +02:00
11 changed files with 517 additions and 217 deletions
+130 -47
View File
@@ -146,6 +146,26 @@ jobs:
printf '%s\n' "$token" > "$RUNNER_TEMP/data/readme.txt"
cat > "$RUNNER_TEMP/oem/sync-log.bat" <<'BATCH'
@echo off
setlocal
:sync
if exist C:\OEM\install.log (
copy /Y C:\OEM\install.log \\host.lan\Data\install.tmp >nul 2>&1
if not errorlevel 1 (
move /Y \\host.lan\Data\install.tmp \\host.lan\Data\install.log >nul 2>&1
)
)
if /I "%~1"=="once" exit /B
if exist C:\OEM\install.done exit /B
ping 127.0.0.1 -n 6 >nul
goto sync
BATCH
case "$CALLBACK" in
powershell)
cat > "$RUNNER_TEMP/oem/ready.ps1" <<'POWERSHELL'
@@ -156,29 +176,29 @@ jobs:
$ErrorActionPreference = "Stop"
$windows = Get-CimInstance Win32_OperatingSystem
$registry = Get-ItemProperty `
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
$platform = switch (
$env:PROCESSOR_ARCHITECTURE.ToUpperInvariant()
) {
"AMD64" {
"x64"
}
"ARM64" {
"arm64"
}
"X86" {
"x86"
}
default {
$env:PROCESSOR_ARCHITECTURE.ToLowerInvariant()
}
}
while ($true) {
try {
$windows = Get-CimInstance Win32_OperatingSystem
$registry = Get-ItemProperty `
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
$platform = switch (
$env:PROCESSOR_ARCHITECTURE.ToUpperInvariant()
) {
"AMD64" {
"x64"
}
"ARM64" {
"arm64"
}
"X86" {
"x86"
}
default {
$env:PROCESSOR_ARCHITECTURE.ToLowerInvariant()
}
}
$share = (
Get-Content `
-LiteralPath "\\host.lan\Data\readme.txt" `
@@ -214,6 +234,7 @@ jobs:
break
}
catch {
Write-Output "$(Get-Date -Format s) - Callback retry: $($_.Exception.Message)"
Start-Sleep -Seconds 10
}
}
@@ -221,9 +242,17 @@ jobs:
cat > "$RUNNER_TEMP/oem/install.bat" <<EOF
@echo off
del /Q C:\OEM\install.done 2>nul
start "" /B cmd.exe /C C:\OEM\sync-log.bat
powershell.exe -NoProfile -ExecutionPolicy Bypass ^
-File C:\OEM\ready.ps1 ^
-Token "$token"
set "result=%errorlevel%"
type nul > C:\OEM\install.done
call C:\OEM\sync-log.bat once
exit /B %result%
EOF
;;
@@ -327,34 +356,41 @@ jobs:
Dim temporary
Dim destination
Dim file
Set filesystem = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer(".", "root\cimv2")
Set systems = service.ExecQuery("SELECT Caption, Version, BuildNumber FROM Win32_OperatingSystem")
caption = ""
version = ""
build = ""
For Each system In systems
caption = CStr(system.Caption)
version = CStr(system.Version)
build = CStr(system.BuildNumber)
Exit For
Next
edition = ReadRegistry(shell, "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID")
platform = GetPlatform(shell)
Dim success
temporary = "\\host.lan\Data\windows.tmp"
destination = "\\host.lan\Data\windows.json"
Do
On Error Resume Next
success = False
share = ReadTextFile(filesystem, "\\host.lan\Data\readme.txt")
On Error Resume Next
Err.Clear
Set filesystem = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer(".", "root\cimv2")
Set systems = service.ExecQuery("SELECT Caption, Version, BuildNumber FROM Win32_OperatingSystem")
caption = ""
version = ""
build = ""
If Err.Number = 0 Then
For Each system In systems
caption = CStr(system.Caption)
version = CStr(system.Version)
build = CStr(system.BuildNumber)
Exit For
Next
End If
If Err.Number = 0 Then
edition = ReadRegistry(shell, "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID")
platform = GetPlatform(shell)
share = ReadTextFile(filesystem, "\\host.lan\Data\readme.txt")
End If
If Err.Number = 0 Then
json = _
@@ -371,7 +407,9 @@ jobs:
Set file = filesystem.OpenTextFile(temporary, ForWriting, True)
file.Write json
file.Close
End If
If Err.Number = 0 Then
If filesystem.FileExists(destination) Then
filesystem.DeleteFile destination, True
End If
@@ -380,20 +418,38 @@ jobs:
End If
If Err.Number = 0 Then
On Error GoTo 0
Exit Do
success = True
Else
WScript.Echo _
Now & _
" - Callback retry: 0x" & _
Hex(Err.Number) & _
" - " & _
Err.Description
End If
Err.Clear
On Error GoTo 0
If success Then
Exit Do
End If
WScript.Sleep 10000
Loop
VBSCRIPT
cat > "$RUNNER_TEMP/oem/install.bat" <<EOF
@echo off
del /Q C:\OEM\install.done 2>nul
start "" /B cmd.exe /C C:\OEM\sync-log.bat
cscript.exe //B //NoLogo C:\OEM\ready.vbs "$token"
set "result=%errorlevel%"
type nul > C:\OEM\install.done
call C:\OEM\sync-log.bat once
exit /B %result%
EOF
;;
esac
@@ -434,6 +490,7 @@ jobs:
--env "RAM_SIZE=half" \
--env "CPU_CORES=half" \
--env "CPU_MODEL=$CPU" \
--env "LOG=Y" \
--env "DISK_SIZE=64G" \
--volume "$RUNNER_TEMP/data:/shared" \
--volume "$RUNNER_TEMP/oem:/oem:ro" \
@@ -450,10 +507,36 @@ jobs:
"$CONTAINER" &
logs_pid="$!"
guest_log="$RUNNER_TEMP/data/install.log"
(
offset=0
snapshot="$RUNNER_TEMP/install-log.snapshot"
while true; do
if cp "$guest_log" "$snapshot" 2>/dev/null; then
size="$(stat -c %s "$snapshot" 2>/dev/null || echo 0)"
if (( size < offset )); then
offset=0
fi
if (( size > offset )); then
tail -c "+$((offset + 1))" "$snapshot" 2>/dev/null |
sed -u 's/^/[install.bat] /' || true
offset="$size"
fi
fi
sleep 2
done
) &
guest_logs_pid="$!"
stop_logs() {
kill "$logs_pid" 2>/dev/null || true
wait "$logs_pid" 2>/dev/null || true
kill "$logs_pid" "$guest_logs_pid" 2>/dev/null || true
wait "$logs_pid" "$guest_logs_pid" 2>/dev/null || true
}
trap stop_logs EXIT
+85 -17
View File
@@ -23,12 +23,18 @@ jobs:
uses: actions/checkout@v7
with:
fetch-depth: 0
-
name: Install aria2
run: |
if ! command -v aria2c > /dev/null; then
sudo apt-get update -qq
sudo apt-get install -qq --no-install-recommends -y aria2
fi
-
name: Validate all download mirrors
id: validate
run: |
errors=0
skipped=0
tested=0
host=""
failed_links=""
@@ -37,21 +43,88 @@ jobs:
ignored_domains=(
files.dog
bobpony.com
)
wget https://github.com/lwthiker/curl-impersonate/releases/download/v0.6.1/curl-impersonate-v0.6.1.x86_64-linux-gnu.tar.gz
tar -xzf curl-impersonate-v0.6.1.x86_64-linux-gnu.tar.gz
sudo cp curl-impersonate-ff /usr/local/bin/
check() {
local url="$1" http
local url="$1"
local agent="Mozilla/5.0 (X11; Linux x86_64; rv:154.0) Gecko/20100101 Firefox/154.0"
local tmp output pid blocks bytes rc
local start=$SECONDS
http=$(curl-impersonate-ff -sSL -o /dev/null -w "%{http_code}" --max-time 10 -I -- "$url" 2>&1) || http="000"
[[ "$http" == 2* ]] && return 0
tmp=$(mktemp -d)
output="$tmp/aria2.log"
http=$(curl-impersonate-ff -sSL -o /dev/null -w "%{http_code}" --max-time 10 -r "0-0" -- "$url" 2>&1) || http="000"
[[ "$http" == 2* ]]
aria2c \
--no-conf=true \
--connect-timeout=30 \
--timeout=30 \
--max-tries=2 \
--retry-wait=2 \
--async-dns=false \
--follow-metalink=false \
--follow-torrent=false \
--user-agent="$agent" \
--split=4 \
--max-connection-per-server=4 \
--file-allocation=none \
--allow-overwrite=true \
--auto-file-renaming=false \
--continue=false \
--dir="$tmp" \
--out=probe \
--console-log-level=error \
--summary-interval=0 \
--download-result=hide \
--show-console-readout=false \
--enable-color=false \
-- "$url" > "$output" 2>&1 &
pid=$!
while kill -0 "$pid" 2>/dev/null; do
if [[ -f "$tmp/probe" ]]; then
blocks=$(stat -c '%b' "$tmp/probe" 2>/dev/null || echo 0)
bytes=$((blocks * 512))
if (( bytes >= 1048576 )); then
kill "$pid" 2>/dev/null || true
wait "$pid" 2>/dev/null || true
rm -rf -- "$tmp"
return 0
fi
fi
if (( SECONDS - start >= 60 )); then
kill "$pid" 2>/dev/null || true
break
fi
sleep 0.2
done
if wait "$pid"; then
rc=0
else
rc=$?
fi
blocks=0
if [[ -f "$tmp/probe" ]]; then
blocks=$(stat -c '%b' "$tmp/probe" 2>/dev/null || echo 0)
fi
bytes=$((blocks * 512))
if (( bytes >= 1048576 || (rc == 0 && bytes > 0) )); then
rm -rf -- "$tmp"
return 0
fi
sed 's/^/ /' "$output" >&2
echo " Downloaded bytes: $bytes" >&2
echo " aria2c exit status: $rc" >&2
rm -rf -- "$tmp"
return 1
}
isIgnoredDomain() {
@@ -93,8 +166,7 @@ jobs:
seen[$url]=1
if isIgnoredDomain "$url"; then
echo "SKIP: $url (ignored domain)"
skipped=$((skipped + 1))
echo "SKIP: $url"
continue
fi
@@ -113,10 +185,6 @@ jobs:
echo ""
printf '%d/%d tested links valid\n' "$((tested - errors))" "$tested"
if (( skipped > 0 )); then
printf '%d link(s) skipped for ignored domains\n' "$skipped"
fi
if (( errors > 0 )); then
printf '%d blocking failure(s)\n' "$errors"
+44 -54
View File
@@ -41,7 +41,7 @@ jobs:
minimum_build: 22000
platform: x64
- name: Windows 11 IoT Enterprise
- name: Windows 11 IoT
version: "11i"
expected_caption: Windows 11
expected_edition: IoTEnterpriseS
@@ -69,7 +69,7 @@ jobs:
minimum_build: 10240
platform: x64
- name: Windows 10 IoT Enterprise
- name: Windows 10 IoT
version: "10i"
expected_caption: Windows 10
expected_edition: IoTEnterpriseS
@@ -93,38 +93,6 @@ jobs:
minimum_build: ${{ matrix.minimum_build }}
platform: ${{ matrix.platform }}
tiny:
strategy:
fail-fast: false
matrix:
include:
- name: Core11
version: "core11"
expected_caption: Windows 11
minimum_build: 22000
platform: x64
- name: Tiny11
version: "tiny11"
expected_caption: Windows 11
minimum_build: 22000
platform: x64
- name: Tiny10
version: "tiny10"
expected_caption: Windows 10
minimum_build: 19041
platform: x64
name: ${{ matrix.name }}
uses: ./.github/workflows/install.yml
with:
name: ${{ matrix.name }}
version: ${{ matrix.version }}
expected_caption: ${{ matrix.expected_caption }}
minimum_build: ${{ matrix.minimum_build }}
platform: ${{ matrix.platform }}
server:
strategy:
fail-fast: false
@@ -154,7 +122,7 @@ jobs:
minimum_build: 14393
platform: x64
- name: Windows Server 2012 R2
- name: Windows Server 2012
version: "2012"
expected_caption: Windows Server 2012 R2
minimum_build: 9600
@@ -174,65 +142,56 @@ jobs:
fail-fast: false
matrix:
include:
- name: Windows 7 Ultimate
- name: Windows 7 x64
version: "7u"
cpu: host
expected_caption: Windows 7
minimum_build: 7601
platform: x64
- name: Windows 7 Ultimate x86
- name: Windows 7 x86
version: "7x86"
cpu: host
expected_caption: Windows 7
minimum_build: 7601
platform: x86
- name: Windows Vista Ultimate
- name: Windows Vista x64
version: "vu"
cpu: host
expected_caption: Windows Vista
minimum_build: 6002
platform: x64
- name: Windows Vista Ultimate x86
- name: Windows Vista x86
version: "vistax86"
cpu: host
expected_caption: Windows Vista
minimum_build: 6002
platform: x86
- name: Windows XP Professional
- name: Windows XP x86
version: "xp"
cpu: host
expected_caption: Windows XP
minimum_build: 2600
platform: x86
- name: Windows XP Professional x64
- name: Windows XP x64
version: "xp64"
cpu: host
expected_caption: Windows XP
minimum_build: 3790
platform: x64
- name: Windows 2000 Professional
- name: Windows 2000
version: "2k"
cpu: host
expected_caption: Windows 2000
minimum_build: 2195
platform: x86
- name: Windows Server 2008 R2
- name: Windows Server 2008
version: "2008"
cpu: host
expected_caption: Windows Server 2008 R2
minimum_build: 7601
platform: x64
- name: Windows Server 2003 R2
- name: Windows Server 2003
version: "2003"
cpu: host
expected_caption: Windows Server 2003
minimum_build: 3790
platform: x64
@@ -243,7 +202,38 @@ jobs:
name: ${{ matrix.name }}
version: ${{ matrix.version }}
callback: legacy
cpu: ${{ matrix.cpu }}
expected_caption: ${{ matrix.expected_caption }}
minimum_build: ${{ matrix.minimum_build }}
platform: ${{ matrix.platform }}
tiny:
strategy:
fail-fast: false
matrix:
include:
- name: Core 11
version: "core11"
expected_caption: Windows 11
minimum_build: 22000
platform: x64
- name: Tiny 11
version: "tiny11"
expected_caption: Windows 11
minimum_build: 22000
platform: x64
- name: Tiny 10
version: "tiny10"
expected_caption: Windows 10
minimum_build: 19041
platform: x64
name: ${{ matrix.name }}
uses: ./.github/workflows/install.yml
with:
name: ${{ matrix.name }}
version: ${{ matrix.version }}
expected_caption: ${{ matrix.expected_caption }}
minimum_build: ${{ matrix.minimum_build }}
platform: ${{ matrix.platform }}
+1
View File
@@ -47,6 +47,7 @@ An empty default means the variable is unset and its value is determined automat
| `DISK_DISCARD` | `unmap` | Discard/TRIM mode for the primary disk. |
| `DISK_ROTATION` | `1` | Rotation rate reported to the guest. Use `1` to identify the disk as an SSD. |
| `DISK_FLAGS` | | Additional options used when creating `qcow2` disks. |
| `DISK_OPTIONS` | | Additional options appended to QEMU disk devices. |
| `ALLOCATE` | `N` | Preallocates space for the primary disk. |
| `STORAGE` | `/storage` | Storage directory used for disks, firmware variables, and downloads. |
+5
View File
@@ -133,6 +133,11 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas
| `2012` | Windows Server 2012 | 4.3 GB |
| `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 |
| `reactos` | Reactos | 0.03 GB |
> [!TIP]
> To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/).
+38
View File
@@ -1644,6 +1644,43 @@ writeVBS() {
return 0
}
disableAutoReboot() {
local target="$1"
local file
file=$(find \
"$target" \
-maxdepth 1 \
-type f \
-iname HIVESYS.INF \
-print -quit
) || return 1
if [ -z "$file" ]; then
error "The file HIVESYS.INF could not be found!"
return 1
fi
if grep -Fqi \
'HKLM,"SYSTEM\CurrentControlSet\Control\CrashControl","AutoReboot"' \
"$file"; then
sed -i -E \
's|^(HKLM,"SYSTEM\\CurrentControlSet\\Control\\CrashControl","AutoReboot",[^,]*,)[^[:space:]]*|\1 0|I' \
"$file" || return 1
else
printf '%s\n' \
'HKLM,"SYSTEM\CurrentControlSet\Control\CrashControl","AutoReboot",0x00010001,0' |
unix2dos >> "$file" || return 1
fi
return 0
}
legacyInstall() {
local dir="$2"
@@ -1683,6 +1720,7 @@ legacyInstall() {
addLegacyDrivers "$dir" "$target" "$driver" "$arch" "$drivers" || return 1
fi
disableAutoReboot "$target" || return 1
setLegacyKey "$target" "$driver" "$arch" "$desc" || return 1
validateProductKey "$KEY" || return 1
+36 -1
View File
@@ -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"
+64 -38
View File
@@ -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
@@ -966,7 +984,7 @@ min_severity = warning
show_summary = false
[rules]
disabled_rules = W001,W028,W041,SEC002,SEC005
disabled_rules = W001,W025,W028,W033,W041,SEC002,SEC005
EOC
output=$(
@@ -1044,43 +1062,53 @@ EOC
getBootLoadSize() {
local iso="$1"
local desc="$2"
local boot_info value
local dir="$2"
local desc="$3"
local boot_info size value
if ! boot_info=$(isoinfo -d -i "$iso"); then
case "${DETECTED,,}" in
"win2k"* | "winxp"* | "win2003"* )
case "${DETECTED,,}" in
"win2k"* | "winxp"* | "win2003"* )
BOOT_LOAD_SIZE=4
return 0
;;
esac
if [ ! -s "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in $desc ISO image!"
return 1
fi
error "Failed to read boot image information from $desc ISO!"
return 1
fi
if ! size=$(stat -c%s "$dir/$ETFS"); then
error "Failed to determine boot image size from $desc ISO!"
return 1
fi
value=$(awk '/Nsect / { print $NF; exit }' <<< "$boot_info")
if (( size < 512 || size % 512 != 0 )); then
error "Invalid boot image size found in $desc ISO!"
return 1
fi
if [ -z "$value" ]; then
BOOT_LOAD_SIZE=$((size / 512))
;;
case "${DETECTED,,}" in
"win2k"* | "winxp"* | "win2003"* )
BOOT_LOAD_SIZE=4
return 0
;;
esac
* )
error "Failed to determine boot image load size from $desc ISO!"
return 1
fi
if ! boot_info=$(isoinfo -d -i "$iso"); then
error "Failed to read boot image information from $desc ISO!"
return 1
fi
if [[ ! "$value" =~ ^[0-9]+$ ]] || [ "${#value}" -gt 5 ]; then
error "Invalid boot image load size found in $desc ISO!"
return 1
fi
value=$(awk '/Nsect / { print $NF; exit }' <<< "$boot_info")
BOOT_LOAD_SIZE=$((10#$value))
if [ -z "$value" ]; then
error "Failed to determine boot image load size from $desc ISO!"
return 1
fi
if [[ ! "$value" =~ ^[0-9]+$ ]] || [ "${#value}" -gt 5 ]; then
error "Invalid boot image load size found in $desc ISO!"
return 1
fi
BOOT_LOAD_SIZE=$((10#$value))
;;
esac
if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
error "Invalid boot image load size found in $desc ISO!"
@@ -1097,9 +1125,9 @@ extractBootImage() {
local desc="$3"
local tmp="$TMP/boot-images"
local max_size=$((32 * 1024 * 1024))
local rc size offset image=""
local msg="using legacy extraction..."
local expected_size=$((BOOT_LOAD_SIZE * 512))
local boot_info
local -a images=()
@@ -1130,8 +1158,8 @@ extractBootImage() {
warn "The extracted BIOS boot image is empty, $msg"
elif ! size=$(stat -c%s "$image"); then
warn "Failed to determine the BIOS boot image size, $msg"
elif (( size > max_size )); then
warn "The extracted BIOS boot image exceeds 32 MB, $msg"
elif (( size != expected_size )); then
enabled "$DEBUG" && warn "The extracted BIOS boot image has an unexpected size, $msg"
else
if ! mv -f "$image" "$dir/$ETFS"; then
rm -rf "$tmp" || true
@@ -1162,8 +1190,6 @@ extractBootImage() {
rm -rf "$tmp" || true
local boot_info
if ! boot_info=$(isoinfo -d -i "$iso"); then
error "Failed to read boot image information from $desc ISO!"
return 1
@@ -1184,9 +1210,9 @@ extractBootImage() {
if ! dd \
"if=$iso" \
"of=$dir/$ETFS" \
bs=2048 \
bs=512 \
"count=$BOOT_LOAD_SIZE" \
"skip=$offset" \
"skip=$((offset * 4))" \
status=none; then
rm -f "$dir/$ETFS" || true
error "Failed to extract boot image from $desc ISO!"
+73 -45
View File
@@ -386,15 +386,24 @@ abortInstall() {
local dir="$1"
local iso="$2"
local efi
local efi efi32 efi64
[[ "${iso,,}" == *".esd" ]] && exit 60
enabled "${UNPACK:-}" && exit 60
efi=$(find "$dir" -maxdepth 1 -type d -iname efi -print -quit)
if [[ "${PLATFORM,,}" == "x64" ]]; then
efi=$(find "$dir" -maxdepth 1 -type d -iname efi -print -quit)
efi32=$(find "$dir" -maxdepth 3 -type f \
-ipath '*/efi/boot/bootia32.efi' -print -quit)
efi64=$(find "$dir" -maxdepth 3 -type f \
-ipath '*/efi/boot/bootx64.efi' -print -quit)
if [ -z "$efi" ] ||
{ [ -n "$efi32" ] && [ -z "$efi64" ]; }; then
BOOT_MODE="windows_legacy"
fi
if [ -z "$efi" ]; then
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
fi
if [ -n "$CUSTOM" ]; then
@@ -646,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
@@ -675,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
@@ -717,51 +734,62 @@ setMachine() {
case "${id,,}" in
"win9"* )
USB="no"
VGA="cirrus"
DISK_TYPE="auto"
MACHINE="pc-i440fx-2.4"
BOOT_MODE="windows_legacy"
[ -z "${ADAPTER:-}" ] && ADAPTER="pcnet" ;;
"win2k"* )
VGA="cirrus"
MACHINE="pc"
USB="pci-ohci"
DISK_TYPE="auto"
BOOT_MODE="windows_legacy"
[ -z "${ADAPTER:-}" ] && ADAPTER="rtl8139" ;;
"winxp"* )
DISK_TYPE="blk"
BOOT_MODE="windows_legacy"
[ -z "${SOUND:-}" ] && SOUND="usb-audio"
if [ -z "${CPU_MODEL:-}" ] || [[ "${CPU_MODEL:-}" == "host" ]]; then
# Workaround for boot loop on AMD EPYC processors
if [[ "${id,,}" == "winxpx86"* && "${CPU,,}" == *"amd epyc"* ]]; then
CPU_MODEL="qemu32"
fi
fi ;;
"win2003"* )
DISK_TYPE="blk"
BOOT_MODE="windows_legacy"
[ -z "${SOUND:-}" ] && SOUND="usb-audio" ;;
"winvista"* | "win7"* | "win2008"* )
"win9"* | "win2k"* | "winxp"* | "win2003"* | \
"winvista"* | "win7"* | "win2008"* | "reactos" )
BOOT_MODE="windows_legacy" ;;
esac
case "${id,,}" in
"winxp"* | "win2003"* | "winvistax86"* | "win7x86"* | "win2008r2x86"* )
"win9"* )
isQ35 && MACHINE="pc-i440fx-2.4"
[ -z "${USB:-}" ] && USB="no"
[ -z "${VGA:-}" ] && VGA="cirrus"
[ -z "${ADAPTER:-}" ] && ADAPTER="pcnet"
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE="auto" ;;
"win2k"* )
isQ35 && MACHINE="pc"
[ -z "${VGA:-}" ] && VGA="cirrus"
[ -z "${USB:-}" ] && USB="pci-ohci"
[ -z "${ADAPTER:-}" ] && ADAPTER="rtl8139"
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE="auto" ;;
"winxp"* | "win2003"* )
[ -z "${SOUND:-}" ] && SOUND="usb-audio"
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE="blk" ;;
"reactos" )
isQ35 && MACHINE="pc"
[ -z "${VGA:-}" ] && VGA="cirrus"
[ -z "${REMOVE:-}" ] && REMOVE="N"
[ -z "${USB:-}" ] && USB="pci-ohci"
[ -z "${REBUILD:-}" ] && REBUILD="N"
[ -z "${ADAPTER:-}" ] && ADAPTER="rtl8139"
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE="auto" ;;
esac
case "${id,,}" in
"winvistax86"* | "win7x86"* )
# Fix boot loop issue on AMD EPYC processors
[ -z "${CPU_MODEL:-}" ] && CPU_MODEL="qemu32" ;;
esac
case "${id,,}" in
"winxp"* | "win2003"* | "winvistax86"* | \
"win7x86"* | "win2008r2x86"* | "reactos")
if isQ35 "${MACHINE:-q35}"; then
# Prevent bluescreen if 64 bit PCI hole size is >2G.
ARGS="-global q35-pcihost.x-pci-hole64-fix=false"
fi ;;
esac
@@ -784,7 +812,7 @@ prepareImage() {
if [[ "${BOOT_MODE,,}" == "windows_legacy" &&
"${DETECTED,,}" != "win9"* ]]; then
getBootLoadSize "$iso" "$desc" || return 1
getBootLoadSize "$iso" "$dir" "$desc" || return 1
fi
skipVersion "$DETECTED" && return 0
+12 -6
View File
@@ -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" \
+29 -9
View File
@@ -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