mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 20:47:12 +01:00
Update mido.sh
This commit is contained in:
+46
-31
@@ -740,7 +740,13 @@ getXmlTag() {
|
|||||||
local tag="$1"
|
local tag="$1"
|
||||||
local file="$2"
|
local file="$2"
|
||||||
|
|
||||||
xmllint --nonet --xpath "//$tag" "$file" 2>/dev/null | sed -E -e "s/<[\/]?$tag>//g" || true
|
[[ "$tag" =~ ^[A-Za-z_][A-Za-z0-9_.-]*$ ]] || return 0
|
||||||
|
|
||||||
|
xmlstarlet sel \
|
||||||
|
-t \
|
||||||
|
-m "//*[local-name()='$tag']" \
|
||||||
|
-c 'node()' \
|
||||||
|
"$file" 2>/dev/null || true
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -751,11 +757,9 @@ getESD() {
|
|||||||
local version="$2"
|
local version="$2"
|
||||||
local lang="$3"
|
local lang="$3"
|
||||||
local desc="$4"
|
local desc="$4"
|
||||||
local file result culture
|
local file culture
|
||||||
local language edition catalog
|
local language edition catalog
|
||||||
local xmlFile="products.xml"
|
local xmlFile="products.xml"
|
||||||
local esdFile="esd_edition.xml"
|
|
||||||
local filterFile="products_filter.xml"
|
|
||||||
local log
|
local log
|
||||||
|
|
||||||
file=$(getCatalog "$version" "file")
|
file=$(getCatalog "$version" "file")
|
||||||
@@ -837,56 +841,67 @@ getESD() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local query='//File[Architecture="'${PLATFORM,,}'"]'"${edition}"''
|
local files="//File[Architecture=\"${PLATFORM,,}\"]${edition}"
|
||||||
result=$(xmllint --nonet --xpath "${query}" "$dir/$xmlFile" 2>/dev/null || true)
|
local file_count language_count
|
||||||
|
|
||||||
if [ -z "$result" ]; then
|
file_count=$(xmlstarlet sel \
|
||||||
|
-T -t \
|
||||||
query='//File[Architecture="'${PLATFORM^^}'"]'"${edition}"''
|
-v "count($files)" \
|
||||||
result=$(xmllint --nonet --xpath "${query}" "$dir/$xmlFile" 2>/dev/null || true)
|
"$dir/$xmlFile" 2>/dev/null) || file_count="0"
|
||||||
|
|
||||||
if [ -z "$result" ]; then
|
|
||||||
desc=$(printEdition "$version" "$desc" "Y")
|
|
||||||
language=$(getLanguage "$lang" "desc")
|
|
||||||
error "No download link available for $desc!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [ "$file_count" = "0" ]; then
|
||||||
|
files="//File[Architecture=\"${PLATFORM^^}\"]${edition}"
|
||||||
|
file_count=$(xmlstarlet sel \
|
||||||
|
-T -t \
|
||||||
|
-v "count($files)" \
|
||||||
|
"$dir/$xmlFile" 2>/dev/null) || file_count="0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e '<Catalog>' > "$dir/$filterFile"
|
if [ "$file_count" = "0" ]; then
|
||||||
echo "$result" >> "$dir/$filterFile"
|
desc=$(printEdition "$version" "$desc" "Y")
|
||||||
echo -e '</Catalog>'>> "$dir/$filterFile"
|
language=$(getLanguage "$lang" "desc")
|
||||||
|
error "No download link available for $desc!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
result=$(xmllint --nonet --xpath "//File[LanguageCode=\"${culture,,}\"]" "$dir/$filterFile" 2>/dev/null || true)
|
local localized="$files[LanguageCode=\"${culture,,}\"]"
|
||||||
|
local selected="($localized)[1]"
|
||||||
|
|
||||||
if [ -z "$result" ]; then
|
language_count=$(xmlstarlet sel \
|
||||||
|
-T -t \
|
||||||
|
-v "count($localized)" \
|
||||||
|
"$dir/$xmlFile" 2>/dev/null) || language_count="0"
|
||||||
|
|
||||||
|
if [ "$language_count" = "0" ]; then
|
||||||
desc=$(printEdition "$version" "$desc" "Y")
|
desc=$(printEdition "$version" "$desc" "Y")
|
||||||
language=$(getLanguage "$lang" "desc")
|
language=$(getLanguage "$lang" "desc")
|
||||||
error "No download in the $language language available for $desc!"
|
error "No download in the $language language available for $desc!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$result" > "$dir/$esdFile"
|
local result separator=$'\x1f'
|
||||||
|
|
||||||
ESD=$(getXmlTag "FilePath" "$dir/$esdFile")
|
result=$(xmlstarlet sel \
|
||||||
|
-t \
|
||||||
|
-c "$selected/FilePath/text()" -o "$separator" \
|
||||||
|
-c "$selected/Sha1/text()" -o "$separator" \
|
||||||
|
-c "$selected/Size/text()" \
|
||||||
|
"$dir/$xmlFile" 2>/dev/null) || result="${separator}${separator}"
|
||||||
|
|
||||||
|
IFS="$separator" read -r ESD ESD_SUM ESD_SIZE <<< "$result"
|
||||||
|
|
||||||
if [ -z "$ESD" ]; then
|
if [ -z "$ESD" ]; then
|
||||||
error "Failed to find ESD URL in $esdFile!"
|
error "Failed to find ESD URL!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ESD_SUM=$(getXmlTag "Sha1" "$dir/$esdFile")
|
|
||||||
|
|
||||||
if [ -z "$ESD_SUM" ]; then
|
if [ -z "$ESD_SUM" ]; then
|
||||||
error "Failed to find ESD checksum in $esdFile!"
|
error "Failed to find ESD checksum!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ESD_SIZE=$(getXmlTag "Size" "$dir/$esdFile")
|
|
||||||
|
|
||||||
if [ -z "$ESD_SIZE" ]; then
|
if [ -z "$ESD_SIZE" ]; then
|
||||||
error "Failed to find ESD filesize in $esdFile!"
|
error "Failed to find ESD filesize!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user