mirror of
https://github.com/dockur/windows.git
synced 2025-10-29 20:25:49 +00:00
fix: Refactor
This commit is contained in:
parent
f4c728bed4
commit
00bcdf9512
1 changed files with 17 additions and 32 deletions
|
|
@ -279,7 +279,7 @@ verifyFile() {
|
||||||
local check="$4"
|
local check="$4"
|
||||||
|
|
||||||
if [ -n "$size" ] && [[ "$total" != "$size" ]] && [[ "$size" != "0" ]]; then
|
if [ -n "$size" ] && [[ "$total" != "$size" ]] && [[ "$size" != "0" ]]; then
|
||||||
warn "The downloaded file has an invalid size: $total bytes, while expected value was: $size bytes. Please report this at $SUPPORT/issues"
|
warn "The downloaded file has an unexpected size: $total bytes, while expected value was: $size bytes. Please report this at $SUPPORT/issues"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local hash=""
|
local hash=""
|
||||||
|
|
@ -431,10 +431,9 @@ downloadImage() {
|
||||||
tried="y"
|
tried="y"
|
||||||
|
|
||||||
if getESD "$TMP/esd" "$version"; then
|
if getESD "$TMP/esd" "$version"; then
|
||||||
local prev="$ISO"
|
|
||||||
ISO="${ISO%.*}.esd"
|
ISO="${ISO%.*}.esd"
|
||||||
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
|
||||||
ISO="$prev"
|
ISO="$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
@ -663,41 +662,27 @@ selectVersion() {
|
||||||
detectVersion() {
|
detectVersion() {
|
||||||
|
|
||||||
local xml="$1"
|
local xml="$1"
|
||||||
local id=""
|
local id arch
|
||||||
local arch=""
|
|
||||||
local tag="ARCH"
|
local tag="ARCH"
|
||||||
local platform="x64"
|
local platform="x64"
|
||||||
|
local compat="$platform"
|
||||||
|
|
||||||
arch=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
|
arch=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
|
||||||
|
|
||||||
case "${arch,,}" in
|
case "${arch,,}" in
|
||||||
"0" )
|
"0" ) platform="x86"; compat="x64" ;;
|
||||||
platform="x86"
|
"9" ) platform="x64"; compat="$platform" ;;
|
||||||
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
"12" )platform="arm64"; compat="$platform" ;;
|
||||||
error "You cannot boot $platform images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"9" )
|
|
||||||
platform="x64"
|
|
||||||
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
|
||||||
error "You cannot boot $platform images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"12" )
|
|
||||||
platform="arm64"
|
|
||||||
if [[ "${PLATFORM,,}" != "arm64" ]]; then
|
|
||||||
error "You cannot boot ${platform^^} images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ "${compat,,}" != "${PLATFORM,,}" ]]; then
|
||||||
|
error "You cannot boot ${platform^^} images on a $PLATFORM cpu!"
|
||||||
|
exit 67
|
||||||
|
fi
|
||||||
|
|
||||||
id=$(selectVersion "DISPLAYNAME" "$xml" "$platform")
|
id=$(selectVersion "DISPLAYNAME" "$xml" "$platform")
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
[ -z "$id" ] && id=$(selectVersion "PRODUCTNAME" "$xml" "$platform")
|
||||||
|
[ -z "$id" ] && id=$(selectVersion "NAME" "$xml" "$platform")
|
||||||
id=$(selectVersion "PRODUCTNAME" "$xml" "$platform")
|
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
|
||||||
|
|
||||||
id=$(selectVersion "NAME" "$xml" "$platform")
|
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -711,8 +696,8 @@ detectImage() {
|
||||||
|
|
||||||
XML=""
|
XML=""
|
||||||
|
|
||||||
if [ -z "$DETECTED" ] && [[ "${version,,}" != "http"* ]]; then
|
if [ -z "$DETECTED" ] && [ -z "$CUSTOM" ]; then
|
||||||
[ -z "$CUSTOM" ] && DETECTED="$version"
|
[[ "${version,,}" != "http"* ]] && DETECTED="$version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DETECTED" ]; then
|
if [ -n "$DETECTED" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue