diff --git a/Dockerfile b/Dockerfile index 2eb04bd..cb8715c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM scratch AS build-amd64 COPY --from=qemux/qemu:7.12 / / +ARG TARGETARCH ARG DEBCONF_NOWARNINGS="yes" ARG DEBIAN_FRONTEND="noninteractive" ARG DEBCONF_NONINTERACTIVE_SEEN="true" @@ -17,9 +18,8 @@ RUN set -eu && \ dos2unix \ cabextract \ libxml2-utils \ - libarchive-tools \ - netcat-openbsd && \ - wget "https://github.com/gershnik/wsdd-native/releases/download/v1.21/wsddn_1.21_amd64.deb" -O /tmp/wsddn.deb -q && \ + libarchive-tools && \ + wget "https://github.com/gershnik/wsdd-native/releases/download/v1.21/wsddn_1.21_${TARGETARCH}.deb" -O /tmp/wsddn.deb -q && \ dpkg -i /tmp/wsddn.deb && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/readme.md b/readme.md index 7f4fa38..1c41efa 100644 --- a/readme.md +++ b/readme.md @@ -95,7 +95,7 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas |---|---|---| | `11` | Windows 11 Pro | 5.4 GB | | `11l` | Windows 11 LTSC | 4.7 GB | - | `11e` | Windows 11 Enterprise | 4.0 GB | + | `11e` | Windows 11 Enterprise | 5.3 GB | |||| | `10` | Windows 10 Pro | 5.7 GB | | `10l` | Windows 10 LTSC | 4.6 GB | @@ -107,8 +107,8 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas | `xp` | Windows XP Professional | 0.6 GB | | `2k` | Windows 2000 Professional | 0.4 GB | |||| - | `2025` | Windows Server 2025 | 5.6 GB | - | `2022` | Windows Server 2022 | 4.7 GB | + | `2025` | Windows Server 2025 | 6.7 GB | + | `2022` | Windows Server 2022 | 6.0 GB | | `2019` | Windows Server 2019 | 5.3 GB | | `2016` | Windows Server 2016 | 6.5 GB | | `2012` | Windows Server 2012 | 4.3 GB | diff --git a/src/define.sh b/src/define.sh index bd41f80..9b47786 100644 --- a/src/define.sh +++ b/src/define.sh @@ -33,11 +33,11 @@ parseVersion() { "11e" | "win11e" | "windows11e" | "windows 11e" ) VERSION="win11x64-enterprise-eval" ;; - "11i" | "11iot" | "iot11" | "win11i" | "win11-iot" | "win11x64-iot" | "win11x64-enterprise-iot-eval" ) + "11i" | "11iot" | "iot11" | "win11i" | "win11-iot" | "win11x64-iot" ) VERSION="win11x64-enterprise-iot-eval" [ -z "$DETECTED" ] && DETECTED="win11x64-iot" ;; - "11l" | "11ltsc" | "ltsc11" | "win11l" | "win11-ltsc" | "win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" ) + "11l" | "11ltsc" | "ltsc11" | "win11l" | "win11-ltsc" | "win11x64-ltsc" ) VERSION="win11x64-enterprise-ltsc-eval" [ -z "$DETECTED" ] && DETECTED="win11x64-ltsc" ;; @@ -47,11 +47,11 @@ parseVersion() { "10e" | "win10e" | "windows10e" | "windows 10e" ) VERSION="win10x64-enterprise-eval" ;; - "10i" | "10iot" | "iot10" | "win10i" | "win10-iot" | "win10x64-iot" | "win10x64-enterprise-iot-eval" ) + "10i" | "10iot" | "iot10" | "win10i" | "win10-iot" | "win10x64-iot" ) VERSION="win10x64-enterprise-iot-eval" [ -z "$DETECTED" ] && DETECTED="win10x64-iot" ;; - "10l" | "10ltsc" | "ltsc10" | "win10l" | "win10-ltsc" | "win10x64-ltsc" | "win10x64-enterprise-ltsc-eval" ) + "10l" | "10ltsc" | "ltsc10" | "win10l" | "win10-ltsc" | "win10x64-ltsc" ) VERSION="win10x64-enterprise-ltsc-eval" [ -z "$DETECTED" ] && DETECTED="win10x64-ltsc" ;; @@ -693,26 +693,9 @@ switchEdition() { local id="$1" - case "${id,,}" in - "win11${PLATFORM,,}-enterprise-eval" ) - DETECTED="win11${PLATFORM,,}-enterprise" - ;; - "win10${PLATFORM,,}-enterprise-eval" ) - DETECTED="win10${PLATFORM,,}-enterprise" - ;; - "win81${PLATFORM,,}-enterprise-eval" ) - DETECTED="win81${PLATFORM,,}-enterprise" - ;; - "win7${PLATFORM,,}" | "win7${PLATFORM,,}-enterprise-eval" ) - DETECTED="win7${PLATFORM,,}-enterprise" - ;; - "win2025-eval" ) DETECTED="win2025" ;; - "win2022-eval" ) DETECTED="win2022" ;; - "win2019-eval" ) DETECTED="win2019" ;; - "win2016-eval" ) DETECTED="win2016" ;; - "win2012r2-eval" ) DETECTED="win2012r2" ;; - "win2008r2-eval" ) DETECTED="win2008r2" ;; - esac + if [[ "${id,,}" == *"-eval" ]]; then + [ -z "$DETECTED" ] && DETECTED="${id::-5}" + fi return 0 } @@ -734,8 +717,8 @@ getMido() { sum="b56b911bf18a2ceaeb3904d87e7c770bdf92d3099599d61ac2497b91bf190b11" ;; "win11x64-enterprise-eval" ) - size=4295096320 - sum="dad633276073f14f3e0373ef7e787569e216d54942ce522b39451c8f2d38ad43" + size=5387960320 + sum="755a90d43e826a74b9e1932a34788b898e028272439b777e5593dee8d53622ae" url="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENTENTERPRISEEVAL_OEMRET_A64FRE_en-us.iso" ;; "win11x64-enterprise-iot-eval" | "win11x64-enterprise-ltsc-eval" ) @@ -828,12 +811,12 @@ getLink1() { sum="aa1ad990f930d907b7a34ea897abbb0dfbe47552ca8acc146f92e40381839e05" url="11/en-us_windows_11_24h2_x64.iso" ;; - "win11x64-iot" | "win11x64-enterprise-iot-eval" ) + "win11x64-iot" | "win11x64-enterprise-iot" | "win11x64-enterprise-iot-eval" ) size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" ;; - "win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" ) + "win11x64-ltsc" | "win11x64-enterprise-ltsc" | "win11x64-enterprise-ltsc-eval" ) size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="11/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" @@ -843,12 +826,12 @@ getLink1() { sum="557871965263d0fd0a1ea50b5d0d0d7cb04a279148ca905c1c675c9bc0d5486c" url="10/en-us_windows_10_22h2_x64.iso" ;; - "win10x64-iot" | "win10x64-enterprise-iot-eval" ) + "win10x64-iot" | "win10x64-enterprise-iot" | "win10x64-enterprise-iot-eval" ) size=4851668992 sum="a0334f31ea7a3e6932b9ad7206608248f0bd40698bfb8fc65f14fc5e4976c160" url="10/en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f.iso" ;; - "win10x64-ltsc" | "win10x64-enterprise-ltsc-eval" ) + "win10x64-ltsc" | "win10x64-enterprise-ltsc" | "win10x64-enterprise-ltsc-eval" ) size=4899461120 sum="c90a6df8997bf49e56b9673982f3e80745058723a707aef8f22998ae6479597d" url="10/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso" @@ -864,14 +847,14 @@ getLink1() { url="8.x/8.1/en_windows_8.1_enterprise_with_update_x64_dvd_6054382.iso" ;; "win2025" | "win2025-eval" ) - size=5307176960 - sum="2293897341febdcea599f5412300b470b5288c6fd2b89666a7b27d283e8d3cf3" - url="server/2025/en-us_windows_server_2025_preview_x64_dvd_ce9eb1a5.iso" + size=6786627584 + sum="bf3ef0849c7cb5e818e1035b7466d206af5aa227ace1a3f4b0de2bf00d2e2144" + url="server/2025/en-us_windows_server_2025_updated_april_2025_x64_dvd_ea86301d.iso" ;; "win2022" | "win2022-eval" ) - size=5365624832 - sum="c3c57bb2cf723973a7dcfb1a21e97dfa035753a7f111e348ad918bb64b3114db" - url="server/2022/en-us_windows_server_2022_updated_jan_2024_x64_dvd_2b7a0c9f.iso" + size=6005706752 + sum="cea2cb2c09de9910c236e64eae3a801c55e9c77ec25e8d81585e3a4581d24bfb" + url="server/2022/en-us_windows_server_2022_updated_april_2025_x64_dvd_3f755ec1.iso" ;; "win2019" | "win2019-eval" ) size=5575774208 @@ -1134,12 +1117,12 @@ getLink4() { sum="c8dbc96b61d04c8b01faf6ce0794fdf33965c7b350eaa3eb1e6697019902945c" url="Windows11Enterprise23H2x64/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso" ;; - "win11x64-iot" | "win11x64-enterprise-iot-eval" ) + "win11x64-iot" | "win11x64-enterprise-iot" | "win11x64-enterprise-iot-eval" ) size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="Windows11LTSC/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" ;; - "win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" ) + "win11x64-ltsc" | "win11x64-enterprise-ltsc" | "win11x64-enterprise-ltsc-eval" ) size=5144817664 sum="4f59662a96fc1da48c1b415d6c369d08af55ddd64e8f1c84e0166d9e50405d7a" url="Windows11LTSC/X23-81951_26100.1742.240906-0331.ge_release_svc_refresh_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso" @@ -1149,12 +1132,12 @@ getLink4() { sum="7847abd6f39abd02dc8089c4177d354f9eb66fa0ee2fe8ae20e596e675d1ab67" url="Windows-10-22H2-July-2024-64-bit-DVD-English/en-us_windows_10_business_editions_version_22h2_updated_july_2024_x64_dvd_c004521a.iso" ;; - "win10x64-iot" | "win10x64-enterprise-iot-eval" ) + "win10x64-iot" | "win10x64-enterprise-iot" | "win10x64-enterprise-iot-eval" ) size=4851668992 sum="a0334f31ea7a3e6932b9ad7206608248f0bd40698bfb8fc65f14fc5e4976c160" url="en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f_202411/en-us_windows_10_iot_enterprise_ltsc_2021_x64_dvd_257ad90f.iso" ;; - "win10x64-ltsc" | "win10x64-enterprise-ltsc-eval" ) + "win10x64-ltsc" | "win10x64-enterprise-ltsc" | "win10x64-enterprise-ltsc-eval" ) size=4899461120 sum="c90a6df8997bf49e56b9673982f3e80745058723a707aef8f22998ae6479597d" url="en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96_202302/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso" @@ -1313,6 +1296,8 @@ isMido() { local lang="$2" local sum + [[ "${MIDO:-}" == [Nn]* ]] && return 1 + sum=$(getMido "$id" "en" "sum") [ -n "$sum" ] && return 0 @@ -1324,6 +1309,8 @@ isESD() { local id="$1" local lang="$2" + [[ "${ESD:-}" == [Nn]* ]] && return 1 + case "${id,,}" in "win11${PLATFORM,,}" | "win10${PLATFORM,,}" ) return 0 diff --git a/src/install.sh b/src/install.sh index e0be8f8..818f52f 100644 --- a/src/install.sh +++ b/src/install.sh @@ -301,7 +301,11 @@ extractESD() { fi local esdImageCount - esdImageCount=$(wimlib-imagex info "$iso" | awk '/Image Count:/ {print $3}') + esdImageCount=$(wimlib-imagex info "$iso" | iconv -f UTF-16LE -t UTF-8 | awk '/Image Count:/ {print $3}') + + if [ -z "$esdImageCount" ]; then + error "Cannot read the image count in ESD file!" && return 1 + fi wimlib-imagex apply "$iso" 1 "$dir" --quiet 2>/dev/null || { retVal=$? @@ -344,7 +348,7 @@ extractESD() { fi for (( imageIndex=4; imageIndex<=esdImageCount; imageIndex++ )); do - imageEdition=$(wimlib-imagex info "$iso" ${imageIndex} | grep '^Description:' | sed 's/Description:[ \t]*//') + imageEdition=$(wimlib-imagex info "$iso" ${imageIndex} | iconv -f UTF-16LE -t UTF-8 | grep '^Description:' | sed 's/Description:[ \t]*//') [[ "${imageEdition,,}" != "${edition,,}" ]] && continue wimlib-imagex export "$iso" ${imageIndex} "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || { retVal=$? @@ -615,7 +619,7 @@ detectImage() { warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" && return 1 fi - info=$(wimlib-imagex info -xml "$wim" | tr -d '\000') + info=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8) checkPlatform "$info" || exit 67 DETECTED=$(detectVersion "$info") @@ -917,7 +921,7 @@ updateImage() { fi index="1" - result=$(wimlib-imagex info -xml "$wim" | tr -d '\000') + result=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8) if [[ "${result^^}" == *""* ]]; then index="2" diff --git a/src/mido.sh b/src/mido.sh index 75e2e5e..4971b11 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -264,28 +264,40 @@ download_windows_eval() { } case "$enterprise_type" in + "iot" | "ltsc" ) + case "${PLATFORM,,}" in + "x64" ) + if [[ "$windows_version" != "windows-10"* ]]; then + iso_download_link=$(echo "$iso_download_links" | head -n 1) + else + iso_download_link=$(echo "$iso_download_links" | head -n 4 | tail -n 1) + fi ;; + "arm64" ) + iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) ;; + * ) + error "Invalid platform specified, value \"$PLATFORM\" is not recognized!" && return 1 ;; + esac ;; "enterprise" ) - iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) - ;; - "iot" ) - if [[ "${PLATFORM,,}" == "x64" ]]; then - iso_download_link=$(echo "$iso_download_links" | head -n 1) - fi - if [[ "${PLATFORM,,}" == "arm64" ]]; then - iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) - fi - ;; - "ltsc" ) - iso_download_link=$(echo "$iso_download_links" | head -n 4 | tail -n 1) - ;; + case "${PLATFORM,,}" in + "x64" ) + if [[ "$windows_version" != "windows-10"* ]]; then + iso_download_link=$(echo "$iso_download_links" | head -n 1) + else + iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) + fi ;; + "arm64" ) + iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) ;; + * ) + error "Invalid platform specified, value \"$PLATFORM\" is not recognized!" && return 1 ;; + esac ;; "server" ) - iso_download_link=$(echo "$iso_download_links" | head -n 1) - ;; + iso_download_link=$(echo "$iso_download_links" | head -n 1) ;; * ) error "Invalid type specified, value \"$enterprise_type\" is not recognized!" && return 1 ;; esac [[ "$DEBUG" == [Yy1]* ]] && echo "Found download link: $iso_download_link" + [ -z "$iso_download_link" ] && error "Could not parse download link from page!" && return 1 # Follow redirect so proceeding log message is useful # This is a request we make that Fido doesn't @@ -323,8 +335,7 @@ getWindows() { case "${version,,}" in "win11${PLATFORM,,}" ) ;; - "win11${PLATFORM,,}-enterprise-iot"* ) ;; - "win11${PLATFORM,,}-enterprise-ltsc"* ) ;; + "win11${PLATFORM,,}-enterprise"* ) ;; * ) if [[ "${PLATFORM,,}" != "x64" ]]; then error "No download for the ${PLATFORM^^} platform available for $edition!" @@ -396,10 +407,11 @@ getESD() { local version="$2" local lang="$3" local desc="$4" + local result local culture local language local editionName - local winCatalog size + local winCatalog culture=$(getLanguage "$lang" "culture") winCatalog=$(getCatalog "$version" "url") @@ -441,32 +453,57 @@ getESD() { error "Failed to find $xFile in $wFile!" && return 1 fi - local edQuery='//File[Architecture="'${PLATFORM}'"][Edition="'${editionName}'"]' + local edQuery='//File[Architecture="'${PLATFORM,,}'"][Edition="'${editionName}'"]' + result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null) + + if [ -z "$result" ]; then + + edQuery='//File[Architecture="'${PLATFORM^^}'"][Edition="'${editionName}'"]' + result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null) + + if [ -z "$result" ]; then + + desc=$(printEdition "$version" "$desc") + language=$(getLanguage "$lang" "desc") + error "No download link available for $desc!" && return 1 + fi + + fi echo -e '' > "$dir/$fFile" - xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" >> "$dir/$fFile" 2>/dev/null + echo "$result" >> "$dir/$fFile" echo -e ''>> "$dir/$fFile" - xmllint --nonet --xpath "//File[LanguageCode=\"${culture,,}\"]" "$dir/$fFile" >"$dir/$eFile" + result=$(xmllint --nonet --xpath "//File[LanguageCode=\"${culture,,}\"]" "$dir/$fFile" 2>/dev/null) - size=$(stat -c%s "$dir/$eFile") - if ((size<20)); then + if [ -z "$result" ]; then desc=$(printEdition "$version" "$desc") language=$(getLanguage "$lang" "desc") error "No download in the $language language available for $desc!" && return 1 fi + echo "$result" > "$dir/$eFile" + local tag="FilePath" - ESD=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g") + ESD=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g" 2>/dev/null) if [ -z "$ESD" ]; then error "Failed to find ESD URL in $eFile!" && return 1 fi tag="Sha1" - ESD_SUM=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g") + ESD_SUM=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g" 2>/dev/null) + + if [ -z "$ESD_SUM" ]; then + error "Failed to find ESD checksum in $eFile!" && return 1 + fi + tag="Size" - ESD_SIZE=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g") + ESD_SIZE=$(xmllint --nonet --xpath "//$tag" "$dir/$eFile" | sed -E -e "s/<[\/]?$tag>//g" 2>/dev/null) + + if [ -z "$ESD_SIZE" ]; then + error "Failed to find ESD filesize in $eFile!" && return 1 + fi rm -rf "$dir" return 0 @@ -561,6 +598,7 @@ downloadFile() { fi info "$msg..." + [[ "$DEBUG" == [Yy1]* ]] && echo "Downloading: $url" { wget "$url" -O "$iso" -q --timeout=30 --no-http-keep-alive --user-agent "$agent" --show-progress "$progress"; rc=$?; } || :