Update install.sh

This commit is contained in:
Kroese 2024-05-06 04:20:05 +02:00 committed by GitHub
parent dbaeea0381
commit abb58675e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -626,13 +626,14 @@ selectVersion() {
local tag="$1"
local xml="$2"
local platform="$3"
local id find name prefer
name=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
[[ "$name" == *"Operating System"* ]] && name=""
[ -z "$name" ] && return 0
id=$(fromName "$name")
id=$(fromName "$name" "$platform")
[ -z "$id" ] && warn "Unknown ${tag,,}: '$name'" && return 0
prefer="$id-enterprise"
@ -653,7 +654,7 @@ selectVersion() {
echo "$prefer" && return 0
fi
prefer=$(getVersion "$name")
prefer=$(getVersion "$name" "$platform")
echo "$prefer"
return 0
@ -663,14 +664,25 @@ detectVersion() {
local xml="$1"
local id=""
local arch=""
local tag="ARCH"
local platform="x64"
id=$(selectVersion "DISPLAYNAME" "$xml")
arch=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
case "${arch,,}" in
"0" ) platform="x86" ;;
"9" ) platform="x64" ;;
"12" ) platform="arm64" ;;
esac
id=$(selectVersion "DISPLAYNAME" "$xml" "$platform")
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
id=$(selectVersion "PRODUCTNAME" "$xml")
id=$(selectVersion "PRODUCTNAME" "$xml" "$platform")
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
id=$(selectVersion "NAME" "$xml")
id=$(selectVersion "NAME" "$xml" "$platform")
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
return 0