From 73793dbcaaa3d68ca12d2825c9aa47d8b6ee88c0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 26 Jan 2024 22:11:12 +0100 Subject: [PATCH] feat: Switch Win7 mirror (#104) --- Dockerfile | 2 +- assets/{win7x64-ultimate.xml => win7x64.xml} | 4 +- readme.md | 2 +- src/install.sh | 81 ++++++++++++-------- 4 files changed, 51 insertions(+), 38 deletions(-) rename assets/{win7x64-ultimate.xml => win7x64.xml} (99%) diff --git a/Dockerfile b/Dockerfile index c2968e9..b6b00e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update \ COPY ./src /run/ COPY ./assets /run/assets -ADD https://github.com/qemus/virtiso/raw/master/virtio-win.iso /run/drivers.iso +ADD https://github.com/qemus/virtiso/releases/download/v0.1.240/virtio-win-0.1.240.iso /run/drivers.iso RUN chmod +x /run/*.sh EXPOSE 8006 3389 diff --git a/assets/win7x64-ultimate.xml b/assets/win7x64.xml similarity index 99% rename from assets/win7x64-ultimate.xml rename to assets/win7x64.xml index 8559b3d..e98dfa6 100644 --- a/assets/win7x64-ultimate.xml +++ b/assets/win7x64.xml @@ -52,8 +52,8 @@ - /IMAGE/INDEX - 1 + Windows 7 Ultimate + /IMAGE/NAME diff --git a/readme.md b/readme.md index 17957a0..7164e95 100644 --- a/readme.md +++ b/readme.md @@ -80,7 +80,7 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti | ```win10``` | Windows 10 Pro | Microsoft | Fast | 5.8 GB | | ```ltsc10``` | Windows 10 LTSC | Microsoft | Fast | 4.6 GB | | ```win81``` | Windows 8.1 Pro | Microsoft | Fast | 4.2 GB | - | ```win7``` | Windows 7 Ultimate | Archive.org | Slow | 5.5 GB | + | ```win7``` | Windows 7 SP1 | Bob Pony | Medium | 3.2 GB | | ```win22``` | Windows Server 2022 | Microsoft | Fast | 4.7 GB | | ```win19``` | Windows Server 2019 | Microsoft | Fast | 5.3 GB | | ```win16``` | Windows Server 2016 | Microsoft | Fast | 6.5 GB | diff --git a/src/install.sh b/src/install.sh index 9c9578d..9887d09 100644 --- a/src/install.sh +++ b/src/install.sh @@ -2,6 +2,7 @@ set -Eeuo pipefail : "${MANUAL:=""}" +: "${DETECTED:=""}" : "${VERSION:="win11x64"}" if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then @@ -20,9 +21,8 @@ fi [[ "${VERSION,,}" == "win81" ]] && VERSION="win81x64" [[ "${VERSION,,}" == "win8" ]] && VERSION="win81x64" -[[ "${VERSION,,}" == "7" ]] && VERSION="win7x64-ultimate" -[[ "${VERSION,,}" == "win7" ]] && VERSION="win7x64-ultimate" -[[ "${VERSION,,}" == "win7x64" ]] && VERSION="win7x64-ultimate" +[[ "${VERSION,,}" == "7" ]] && VERSION="win7x64" +[[ "${VERSION,,}" == "win7" ]] && VERSION="win7x64" [[ "${VERSION,,}" == "22" ]] && VERSION="win2022-eval" [[ "${VERSION,,}" == "2022" ]] && VERSION="win2022-eval" @@ -44,14 +44,25 @@ fi [[ "${VERSION,,}" == "win10-ltsc" ]] && VERSION="win10x64-enterprise-ltsc-eval" [[ "${VERSION,,}" == "win10x64-ltsc" ]] && VERSION="win10x64-enterprise-ltsc-eval" -if [[ "${VERSION,,}" == "tiny11" ]]; then - VERSION="https://archive.org/download/tiny-11-core-x-64-beta-1/tiny11%20core%20x64%20beta%201.iso" +if [[ "${VERSION,,}" == "win10x64-enterprise-ltsc-eval" ]]; then + DETECTED="win10x64-ltsc" fi if [[ "${VERSION,,}" == "tiny10" ]]; then + DETECTED="win10x64-ltsc" VERSION="https://archive.org/download/tiny-10-23-h2/tiny10%20x64%2023h2.iso" fi +if [[ "${VERSION,,}" == "win7x64" ]]; then + DETECTED="win7x64" + VERSION="https://dl.bobpony.com/windows/7/en_windows_7_with_sp1_x64.iso" +fi + +if [[ "${VERSION,,}" == "tiny11" ]]; then + DETECTED="win11x64" + VERSION="https://archive.org/download/tiny-11-core-x-64-beta-1/tiny11%20core%20x64%20beta%201.iso" +fi + CUSTOM="custom.iso" [ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.iso" @@ -297,18 +308,6 @@ extractImage() { exit 66 fi - if [ ! -f "$dir/$ETFS" ] || [ ! -f "$dir/$EFISYS" ]; then - - if [ ! -f "$dir/$ETFS" ]; then - warn "failed to locate file 'etfsboot.com' in ISO image, $FB" - else - warn "failed to locate file 'efisys_noprompt.bin' in ISO image, $FB" - fi - - BOOT_MODE="windows_legacy" - return 1 - fi - return 0 } @@ -319,11 +318,12 @@ findVersion() { [[ "${name,,}" == *"windows 11"* ]] && detected="win11x64" [[ "${name,,}" == *"windows 8"* ]] && detected="win81x64" + [[ "${name,,}" == *"windows 7"* ]] && detected="win7x64" + [[ "${name,,}" == *"windows vista"* ]] && detected="winvistax64" [[ "${name,,}" == *"server 2022"* ]] && detected="win2022-eval" [[ "${name,,}" == *"server 2019"* ]] && detected="win2019-eval" [[ "${name,,}" == *"server 2016"* ]] && detected="win2016-eval" - [[ "${name,,}" == *"windows 7"* ]] && detected="win7x64-ultimate" - + if [[ "${name,,}" == *"windows 10"* ]]; then if [[ "${name,,}" == *"enterprise ltsc"* ]]; then detected="win10x64-ltsc" @@ -338,30 +338,29 @@ findVersion() { detectImage() { - local dir="$1" - local tag result name name2 - XML="" - DETECTED="" - if [[ "$EXTERNAL" != [Yy1]* ]] && [ -z "$CUSTOM" ]; then - if [[ "${VERSION,,}" != "win10x64-enterprise-ltsc-eval" ]]; then + if [ -n "$CUSTOM" ]; then + DETECTED="" + else + if [ -z "$DETECTED" ] && [[ "$EXTERNAL" != [Yy1]* ]]; then DETECTED="$VERSION" - else - DETECTED="win10x64-ltsc" fi - if [[ "$MANUAL" != [Yy1]* ]]; then - if [ -f "/run/assets/$DETECTED.xml" ]; then - XML="$DETECTED.xml" - else - warn "image type is '$DETECTED', but no matching XML file exists, $FB." - fi + fi + + if [ -n "$DETECTED" ]; then + if [ -f "/run/assets/$DETECTED.xml" ]; then + [[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml" + return 0 fi + warn "image type is '$DETECTED', but no matching XML file exists!" return 0 fi info "Detecting Windows version from ISO image..." + local dir="$1" + local tag result name name2 local loc="$dir/sources/install.wim" [ ! -f "$loc" ] && loc="$dir/sources/install.esd" @@ -410,7 +409,21 @@ prepareImage() { local iso="$1" local dir="$2" - [[ "${DETECTED,,}" != "win7x64"* ]] && return 0 + if [[ "${BOOT_MODE,,}" == "windows" ]]; then + if [[ "${DETECTED,,}" != "win7x64"* ]] && [[ "${DETECTED,,}" != "winvistax64"* ]]; then + + if [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ]; then + return 0 + fi + + if [ ! -f "$dir/$ETFS" ]; then + warn "failed to locate file 'etfsboot.com' in ISO image, falling back to legacy boot!" + else + warn "failed to locate file 'efisys_noprompt.bin' in ISO image, falling back to legacy boot!" + fi + + fi + fi ETFS="boot.img" BOOT_MODE="windows_legacy"