mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 20:47:12 +01:00
feat: Encapsulate edition ordering policy (#2023)
This commit is contained in:
+45
-29
@@ -38,35 +38,6 @@ USERNAME=$(strip "$USERNAME")
|
|||||||
DOMAIN_OU=$(strip "$DOMAIN_OU")
|
DOMAIN_OU=$(strip "$DOMAIN_OU")
|
||||||
WORKGROUP=$(strip "$WORKGROUP")
|
WORKGROUP=$(strip "$WORKGROUP")
|
||||||
|
|
||||||
EDITION_ORDER=(
|
|
||||||
"-enterprise|enterprise|enterprise enterprise-*"
|
|
||||||
"-ultimate|ultimate|ultimate ultimate-*"
|
|
||||||
"|default|@default n pro pro-* professional professional-* business business-*"
|
|
||||||
"-iot|iot|iot iot-* enterprise-iot enterprise-iot-*"
|
|
||||||
"-ltsc|ltsc|ltsc ltsc-* enterprise-ltsc enterprise-ltsc-*"
|
|
||||||
"-education|education|education education-* pro-education pro-education-*"
|
|
||||||
"-home|home|home home-*"
|
|
||||||
"-home-premium|home|home-premium home-premium-*"
|
|
||||||
"-home-basic|home|home-basic home-basic-*"
|
|
||||||
"-starter|starter|starter starter-*"
|
|
||||||
)
|
|
||||||
|
|
||||||
SERVER_EDITION_ORDER=(
|
|
||||||
"|default|@default"
|
|
||||||
"-datacenter|datacenter|datacenter datacenter-*"
|
|
||||||
"-datacenter-azure|datacenter|datacenter-azure"
|
|
||||||
"-enterprise|enterprise|enterprise enterprise-*"
|
|
||||||
"-web|web|web web-*"
|
|
||||||
"-foundation|foundation|foundation foundation-*"
|
|
||||||
"-essentials|essentials|essentials essentials-*"
|
|
||||||
"-standard-core|standard-core|standard-core standard-core-*"
|
|
||||||
"-datacenter-core|datacenter-core|datacenter-core datacenter-core-*"
|
|
||||||
"-datacenter-azure-core|datacenter-core|datacenter-azure-core"
|
|
||||||
"-enterprise-core|enterprise-core|enterprise-core enterprise-core-*"
|
|
||||||
"-web-core|web-core|web-core web-core-*"
|
|
||||||
"-hv|hv|hv hv-*"
|
|
||||||
)
|
|
||||||
|
|
||||||
MIRRORS=4
|
MIRRORS=4
|
||||||
|
|
||||||
parseVersion() {
|
parseVersion() {
|
||||||
@@ -928,6 +899,51 @@ getServerEditionID() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getEditionOrder() {
|
||||||
|
|
||||||
|
local id="${1,,}"
|
||||||
|
local result_name="$2"
|
||||||
|
local -n result="$result_name"
|
||||||
|
|
||||||
|
result=()
|
||||||
|
|
||||||
|
case "$id" in
|
||||||
|
"win20"* )
|
||||||
|
result=(
|
||||||
|
"|default|@default"
|
||||||
|
"-datacenter|datacenter|datacenter datacenter-*"
|
||||||
|
"-datacenter-azure|datacenter|datacenter-azure"
|
||||||
|
"-enterprise|enterprise|enterprise enterprise-*"
|
||||||
|
"-web|web|web web-*"
|
||||||
|
"-foundation|foundation|foundation foundation-*"
|
||||||
|
"-essentials|essentials|essentials essentials-*"
|
||||||
|
"-standard-core|standard-core|standard-core standard-core-*"
|
||||||
|
"-datacenter-core|datacenter-core|datacenter-core datacenter-core-*"
|
||||||
|
"-datacenter-azure-core|datacenter-core|datacenter-azure-core"
|
||||||
|
"-enterprise-core|enterprise-core|enterprise-core enterprise-core-*"
|
||||||
|
"-web-core|web-core|web-core web-core-*"
|
||||||
|
"-hv|hv|hv hv-*"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
result=(
|
||||||
|
"-enterprise|enterprise|enterprise enterprise-*"
|
||||||
|
"-ultimate|ultimate|ultimate ultimate-*"
|
||||||
|
"|default|@default n pro pro-* professional professional-* business business-*"
|
||||||
|
"-iot|iot|iot iot-* enterprise-iot enterprise-iot-*"
|
||||||
|
"-ltsc|ltsc|ltsc ltsc-* enterprise-ltsc enterprise-ltsc-*"
|
||||||
|
"-education|education|education education-* pro-education pro-education-*"
|
||||||
|
"-home|home|home home-*"
|
||||||
|
"-home-premium|home|home-premium home-premium-*"
|
||||||
|
"-home-basic|home|home-basic home-basic-*"
|
||||||
|
"-starter|starter|starter starter-*"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
getVersion() {
|
getVersion() {
|
||||||
|
|
||||||
local id edition
|
local id edition
|
||||||
|
|||||||
+4
-3
@@ -428,12 +428,12 @@ detectVersion() {
|
|||||||
local result_name="$3"
|
local result_name="$3"
|
||||||
local index_name="$4"
|
local index_name="$4"
|
||||||
|
|
||||||
local order_name="EDITION_ORDER"
|
|
||||||
local normalize_name="normalizeEditionID"
|
local normalize_name="normalizeEditionID"
|
||||||
|
|
||||||
local -a bases=()
|
local -a bases=()
|
||||||
local -a groups=()
|
local -a groups=()
|
||||||
local -a versions=()
|
local -a versions=()
|
||||||
|
local -a edition_order=()
|
||||||
local -A image_indexes=()
|
local -A image_indexes=()
|
||||||
|
|
||||||
printf -v "$result_name" '%s' ""
|
printf -v "$result_name" '%s' ""
|
||||||
@@ -450,11 +450,12 @@ detectVersion() {
|
|||||||
|
|
||||||
case "${bases[0],,}" in
|
case "${bases[0],,}" in
|
||||||
"win20"* )
|
"win20"* )
|
||||||
order_name="SERVER_EDITION_ORDER"
|
|
||||||
normalize_name="normalizeServerEditionID"
|
normalize_name="normalizeServerEditionID"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
getEditionOrder "${bases[0]}" edition_order || return 1
|
||||||
|
|
||||||
selectEdition \
|
selectEdition \
|
||||||
versions \
|
versions \
|
||||||
bases \
|
bases \
|
||||||
@@ -464,7 +465,7 @@ detectVersion() {
|
|||||||
"$result_name" \
|
"$result_name" \
|
||||||
"$index_name" \
|
"$index_name" \
|
||||||
"$normalize_name" \
|
"$normalize_name" \
|
||||||
"$order_name" && return 0
|
edition_order && return 0
|
||||||
|
|
||||||
local result="${versions[0]}"
|
local result="${versions[0]}"
|
||||||
local key="${result,,}"
|
local key="${result,,}"
|
||||||
|
|||||||
Reference in New Issue
Block a user