Skip to content

Commit

Permalink
feat: Switch Win7 mirror (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 26, 2024
1 parent 0aea392 commit 73793db
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions assets/win7x64-ultimate.xml → assets/win7x64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/INDEX</Key>
<Value>1</Value>
<Value>Windows 7 Ultimate</Value>
<Key>/IMAGE/NAME</Key>
</MetaData>
</InstallFrom>
<InstallTo>
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
81 changes: 47 additions & 34 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -Eeuo pipefail

: "${MANUAL:=""}"
: "${DETECTED:=""}"
: "${VERSION:="win11x64"}"

if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}

Expand All @@ -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"
Expand All @@ -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"

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 73793db

Please sign in to comment.