Skip to content

Commit

Permalink
feat: Added editions and mirrors (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Apr 30, 2024
1 parent 5768ae5 commit 9d2f095
Show file tree
Hide file tree
Showing 6 changed files with 429 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM scratch
COPY --from=qemux/qemu-arm:1.15 / /
COPY --from=qemux/qemu-arm:1.16 / /

ARG DEBCONF_NOWARNINGS "yes"
ARG DEBIAN_FRONTEND "noninteractive"
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
Select from the values below:
| **Value** | **Description** | **Platform** | **Source** | **Size** |
|---|---|---|---|---|
| `win11` | Windows 11 Pro | ARM64 | Microsoft | 4.6 GB |
| `win10` | Windows 10 Pro | ARM64 | Microsoft | 3.9 GB |
| **Value** | **Version** | **Platform** | **Size** |
|---|---|---|---|
| `win11` | Windows 11 Pro | ARM64 | 4.6 GB |
| `win10` | Windows 10 Pro | ARM64 | 3.9 GB |

To install x86 or x64 versions of Windows use [dockur/windows](https://github.com/dockur/windows/).

Expand Down
147 changes: 147 additions & 0 deletions src/define.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#!/usr/bin/env bash
set -Eeuo pipefail

: "${MANUAL:=""}"
: "${VERSION:=""}"
: "${DETECTED:=""}"
: "${PLATFORM:="ARM64"}"

parseVersion() {

[ -z "$VERSION" ] && VERSION="win11"

if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
VERSION="${VERSION:1:-1}"
fi

case "${VERSION,,}" in
"11" | "win11" | "windows11" | "windows 11")
VERSION="win11${PLATFORM,,}"
;;
"10" | "win10" | "windows10" | "windows 10")
VERSION="win10${PLATFORM,,}"
;;
esac

return 0
}

printVersion() {

local id="$1"
local desc="$2"

[[ "$id" == "win10"* ]] && desc="Windows 10"
[[ "$id" == "win11"* ]] && desc="Windows 11"

[ -z "$desc" ] && desc="Windows"

echo "$desc for ${PLATFORM}"
return 0
}

getName() {

local file="$1"
local desc="$2"

[[ "${file,,}" == "win11"* ]] && desc="Windows 11"
[[ "${file,,}" == "win10"* ]] && desc="Windows 10"
[[ "${file,,}" == *"windows11"* ]] && desc="Windows 11"
[[ "${file,,}" == *"windows10"* ]] && desc="Windows 10"
[[ "${file,,}" == *"windows_11"* ]] && desc="Windows 11"
[[ "${file,,}" == *"windows_10"* ]] && desc="Windows 10"
[[ "${file,,}" == *"windows 11"* ]] && desc="Windows 11"
[[ "${file,,}" == *"windows 10"* ]] && desc="Windows 10"

[ -z "$desc" ] && desc="Windows"

echo "$desc for ${PLATFORM}"
return 0
}

getVersion() {

local name="$1"
local detected=""

[[ "${name,,}" == *"windows 11"* ]] && detected="win11${PLATFORM,,}"
[[ "${name,,}" == *"windows 10"* ]] && detected="win10${PLATFORM,,}"

echo "$detected"
return 0
}

isESD() {

local id="$1"

case "${id,,}" in
"win11${PLATFORM,,}")
return 0
;;
"win10${PLATFORM,,}")
return 0
;;
esac

return 1
}

getLink() {

# Fallbacks for users who cannot connect to the Microsoft servers

local id="$1"
local url=""
local host="https://dl.bobpony.com"

case "${id,,}" in
"win11${PLATFORM,,}")
url="$host/windows/11/en-us_windows_11_23h2_${PLATFORM,,}.iso"
;;
"win10${PLATFORM,,}")
url="$host/windows/10/en-us_windows_10_22h2_${PLATFORM,,}.iso"
;;
esac

echo "$url"
return 0
}

secondLink() {

# Fallbacks for users who cannot connect to the Microsoft servers

local id="$1"
local url=""
local host="https://drive.massgrave.dev"

case "${id,,}" in
"win11${PLATFORM,,}")
url="$host/SW_DVD9_Win_Pro_11_23H2.2_Arm64_English_Pro_Ent_EDU_N_MLF_X23-68023.ISO"
;;
"win10${PLATFORM,,}")
url="$host/SW_DVD9_Win_Pro_10_22H2.15_Arm64_English_Pro_Ent_EDU_N_MLF_X23-67223.ISO"
;;
esac

echo "$url"
return 0
}

validVersion() {

local id="$1"
local url

isESD "$id" && return 0

url=$(getLink "$id")
[ -n "$url" ] && return 0

url=$(secondLink "$id")
[ -n "$url" ] && return 0

return 1
}
3 changes: 2 additions & 1 deletion src/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SUPPORT="https://github.com/dockur/windows-arm"
cd /run

. reset.sh # Initialize system
. define.sh # Define versions
. install.sh # Run installation
. disk.sh # Initialize disks
. display.sh # Initialize graphics
Expand All @@ -28,8 +29,8 @@ info "Booting ${APP}${BOOT_DESC}..."
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15

terminal
( sleep 10; boot ) &
tail -fn +0 "$QEMU_LOG" 2>/dev/null &
( sleep 10; [ ! -f "$QEMU_END" ] && info "Windows started succesfully, visit http://localhost:8006/ to view the screen..." ) &
cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" &
wait $! || :

Expand Down
Loading

0 comments on commit 9d2f095

Please sign in to comment.