Skip to content

Commit 338d857

Browse files
authored
feat: Additional download mirrors (#1212)
1 parent 366305a commit 338d857

File tree

3 files changed

+80
-33
lines changed

3 files changed

+80
-33
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN set -eu && \
2424
COPY --chmod=755 ./src /run/
2525
COPY --chmod=755 ./assets /run/assets
2626

27-
ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.45-0/virtio-win-1.9.45.tar.xz /drivers.txz
27+
ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.45-0/virtio-win-1.9.45.tar.xz /var/drivers.txz
2828

2929
FROM dockurr/windows-arm:${VERSION_ARG} AS build-arm64
3030
FROM build-${TARGETARCH}

src/define.sh

Lines changed: 78 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set -Eeuo pipefail
1616
: "${USERNAME:=""}"
1717
: "${PASSWORD:=""}"
1818

19-
MIRRORS=3
19+
MIRRORS=4
2020

2121
parseVersion() {
2222

@@ -1050,6 +1050,49 @@ getLink2() {
10501050

10511051
getLink3() {
10521052

1053+
local id="$1"
1054+
local lang="$2"
1055+
local ret="$3"
1056+
local url=""
1057+
local sum=""
1058+
local size=""
1059+
local host="https://nixsys.com/drivers"
1060+
1061+
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
1062+
1063+
case "${id,,}" in
1064+
"win7x64" | "win7x64-ultimate" )
1065+
size=3319478272
1066+
sum="3286963e1476082ba882a5058c205c264772bead9e99e15cd1cb255f04b72900"
1067+
url="WINDOWS764_EN_DVD.iso"
1068+
;;
1069+
"win7x86" | "win7x86-ultimate" )
1070+
size=2564784128
1071+
sum="bd4c03c917d00a40222d92a6fab04981a7bd46140bda1888eb961a322e3c5d89"
1072+
url="WINDOWS732_EN_DVD.iso"
1073+
;;
1074+
"winxpx86" )
1075+
size=618065920
1076+
sum="8177d0137dfe4e8296a85793f140806c9250a5992c8e0e50158c742767ad1182"
1077+
url="WinXPsp3.iso"
1078+
;;
1079+
"win2kx86" )
1080+
size=387424256
1081+
sum="08b11c3897eb38d1e6566a17cec5cdf2b3c620444e160e3db200a7e223aabbd8"
1082+
url="Windows_2000_SP4.iso"
1083+
esac
1084+
1085+
case "${ret,,}" in
1086+
"sum" ) echo "$sum" ;;
1087+
"size" ) echo "$size" ;;
1088+
*) [ -n "$url" ] && echo "$host/$url";;
1089+
esac
1090+
1091+
return 0
1092+
}
1093+
1094+
getLink4() {
1095+
10531096
local id="$1"
10541097
local lang="$2"
10551098
local ret="$3"
@@ -1251,6 +1294,7 @@ addFolder() {
12511294

12521295
prepareInstall() {
12531296

1297+
local pid=""
12541298
local dir="$2"
12551299
local desc="$3"
12561300
local driver="$4"
@@ -1278,7 +1322,7 @@ prepareInstall() {
12781322
rm -rf "$drivers"
12791323
mkdir -p "$drivers"
12801324

1281-
if ! bsdtar -xf /drivers.txz -C "$drivers"; then
1325+
if ! bsdtar -xf /var/drivers.txz -C "$drivers"; then
12821326
error "Failed to extract drivers!" && return 1
12831327
fi
12841328

@@ -1337,27 +1381,32 @@ prepareInstall() {
13371381

13381382
fi
13391383

1340-
local pid file setup
1384+
local setup
13411385
setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini -print -quit)
13421386

13431387
if [ -n "$setup" ]; then
13441388

13451389
pid=$(<"$setup")
1390+
pid="${pid%$'\r'}"
1391+
1392+
case "$pid" in
1393+
*"000" | *"270" | *"OEM" ) ;;
1394+
* ) warn "unknown PID found in image: \"${pid:(-3)}\"" ;;
1395+
esac
13461396

13471397
if [[ "$driver" == "2k" ]]; then
13481398

1349-
echo "${pid:0:$((${#pid})) - 4}270" > "$setup"
1399+
echo "${pid:0:$((${#pid})) - 3}270" > "$setup"
13501400

13511401
else
13521402

1353-
pid="${pid:(-4)}"
1354-
1355-
if [[ "${pid:0:3}" == "270" ]]; then
1403+
if [[ "$pid" != *"270" ]]; then
1404+
echo "${pid:0:$((${#pid})) - 3}000" > "$setup"
1405+
else
13561406
warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
13571407
fi
13581408

13591409
fi
1360-
13611410
fi
13621411

13631412
mkdir -p "$dir/\$OEM\$"
@@ -1388,35 +1437,33 @@ prepareInstall() {
13881437
local ip="20.20.20.1"
13891438
[ -n "${VM_NET_IP:-}" ] && ip="${VM_NET_IP%.*}.1"
13901439

1391-
# These are not pirated keys, they come from the official MS documentation.
1392-
case "${driver,,}" in
1393-
"xp" )
1394-
1395-
if [[ "${arch,,}" == "x86" ]]; then
1396-
# Windows XP Professional x86 generic key (no activation, trial-only)
1397-
[ -z "$KEY" ] && KEY="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
1398-
else
1399-
# Windows XP Professional x64 generic key (no activation, trial-only)
1400-
[ -z "$KEY" ] && KEY="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
1401-
fi ;;
1440+
if [ -z "$KEY" ] && [[ "$pid" != *"270" ]]; then
14021441

1403-
"2k3" )
1442+
# These are not pirated keys, they come from the official MS documentation.
1443+
case "${driver,,}" in
1444+
"xp" )
14041445

1405-
if [[ "${arch,,}" == "x86" ]]; then
1406-
# Windows Server 2003 Standard x86 generic key (no activation, trial-only)
1407-
[ -z "$KEY" ] && KEY="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
1408-
else
1409-
# Windows Server 2003 Standard x64 generic key (no activation, trial-only)
1410-
[ -z "$KEY" ] && KEY="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
1411-
fi ;;
1446+
if [[ "${arch,,}" == "x86" ]]; then
1447+
# Windows XP Professional x86 generic key (no activation, trial-only)
1448+
KEY="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
1449+
else
1450+
# Windows XP Professional x64 generic key (no activation, trial-only)
1451+
KEY="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
1452+
fi ;;
14121453

1413-
"2k" )
1454+
"2k3" )
14141455

1415-
KEY="" ;;
1456+
if [[ "${arch,,}" == "x86" ]]; then
1457+
# Windows Server 2003 Standard x86 generic key (no activation, trial-only)
1458+
KEY="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
1459+
else
1460+
# Windows Server 2003 Standard x64 generic key (no activation, trial-only)
1461+
KEY="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
1462+
fi ;;
14161463

1417-
* ) error "Unknown version: \"$driver\"" && return 1 ;;
1464+
esac
14181465

1419-
esac
1466+
fi
14201467

14211468
[ -n "$KEY" ] && KEY="ProductID=$KEY"
14221469

src/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ addDrivers() {
834834
warn "Windows version unknown, falling back to Windows 11 drivers..."
835835
fi
836836

837-
if ! bsdtar -xf /drivers.txz -C "$drivers"; then
837+
if ! bsdtar -xf /var/drivers.txz -C "$drivers"; then
838838
error "Failed to extract drivers from archive!" && return 1
839839
fi
840840

0 commit comments

Comments
 (0)