From 7914ef8132b972885bed39543300da4b05c98c0e Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 20 Dec 2024 15:25:44 +0100 Subject: [PATCH] feat: Add Tiny11 (#240) --- Dockerfile | 2 +- src/define.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++------- src/mido.sh | 5 ++-- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0c776a..687e5f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM scratch -COPY --from=qemux/qemu-arm:2.23 / / +COPY --from=qemux/qemu-arm:2.24 / / ARG VERSION_ARG="0.00" ARG DEBCONF_NOWARNINGS="yes" diff --git a/src/define.sh b/src/define.sh index 1f34ddf..35a2ed3 100644 --- a/src/define.sh +++ b/src/define.sh @@ -14,7 +14,7 @@ set -Eeuo pipefail : "${USERNAME:=""}" : "${PASSWORD:=""}" -MIRRORS=1 +MIRRORS=2 PLATFORM="ARM64" parseVersion() { @@ -95,11 +95,13 @@ parseVersion() { "2003" | "2003r2" | "win2003" | "win2003r2" | "windows2003" | "windows 2003" ) error "Windows Server 2003 $msg" && return 1 ;; - "core11" | "core 11" ) - error "Tiny 11 Core $msg" && return 1 - ;; "tiny11" | "tiny 11" ) - error "Tiny 11 $msg" && return 1 + VERSION="tiny11" + [ -z "$DETECTED" ] && DETECTED="win11arm64" + ;; + "core11" | "core 11" ) + VERSION="core11" + [ -z "$DETECTED" ] && DETECTED="win11arm64" ;; "tiny10" | "tiny 10" ) error "Tiny 10 $msg" && return 1 @@ -386,6 +388,8 @@ printVersion() { local desc="$2" case "${id,,}" in + "tiny11"* ) desc="Tiny 11" ;; + "core11"* ) desc="Core 11" ;; "win10"* ) desc="Windows 10" ;; "win11"* ) desc="Windows 11" ;; esac @@ -439,8 +443,11 @@ fromFile() { local desc="$1" local file="${1,,}" local arch="${PLATFORM,,}" - - case "${file// /_}" in + + file="${file//-/_}" + file="${file// /_}" + + case "$file" in *"_x64_"* | *"_x64."*) arch="x64" ;; @@ -452,7 +459,13 @@ fromFile() { ;; esac - case "${file// /_}" in + case "$file" in + "tiny11core"* | "tiny11_core"* | "tiny_11_core"* ) + id="core11" + ;; + "tiny11"* | "tiny_11"* ) + id="tiny11" + ;; "win10"*| "win_10"* | *"windows10"* | *"windows_10"* ) id="win10${arch}" ;; @@ -600,6 +613,40 @@ getLink1() { return 0 } +getLink2() { + + local id="$1" + local lang="$2" + local ret="$3" + local url="" + local sum="" + local size="" + local host="https://archive.org/download" + + [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0 + + case "${id,,}" in + "tiny11" ) + size=4480499712 + sum="ec6056aa554c17290224af23e1b99961fe99606bb5ea9102d61838939c63325b" + url="tiny11a64/tiny11a64%20r1.iso" + ;; + "core11" ) + size=3300327424 + sum="812dae6b5bf5215db63b61ae10d8f0ffd3aa8529a18d96e9ced53341e2c676ec" + url="tiny11-core-arm64/tiny11%20core%20arm64.iso" + ;; + esac + + case "${ret,,}" in + "sum" ) echo "$sum" ;; + "size" ) echo "$size" ;; + *) [ -n "$url" ] && echo "$host/$url";; + esac + + return 0 +} + getValue() { local val="" diff --git a/src/mido.sh b/src/mido.sh index 1b628a6..e03c9f5 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -608,7 +608,7 @@ getMG() { pattern="10_iot_enterprise_ltsc" ;; esac - + fi local body="" @@ -620,10 +620,11 @@ getMG() { } local list="" - list=$(echo "$body" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i '\.iso$') + list=$(echo "$body" | xmllint --html --nonet --xpath "//a[contains(text(), '.iso')]" - 2>/dev/null) local result="" result=$(echo "$list" | grep -i "${platform}" | grep "${pattern}" | grep -i -m 1 "${locale,,}_") + result=$(echo "$result" | sed -r 's/.*href="([^"]+).*/\1/g') if [ -z "$result" ]; then if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then