mirror of
https://github.com/dockur/windows-arm.git
synced 2024-10-01 07:43:48 +00:00
build: Sync with upstream (#147)
This commit is contained in:
parent
76484e1330
commit
313131d363
4 changed files with 31 additions and 25 deletions
|
@ -291,7 +291,7 @@ printVersion() {
|
||||||
|
|
||||||
if [ -z "$desc" ]; then
|
if [ -z "$desc" ]; then
|
||||||
desc="Windows"
|
desc="Windows"
|
||||||
[[ "${PLATFORM,,}" != "x64" ]] && desc="$desc for ${PLATFORM}"
|
[[ "${PLATFORM,,}" != "x64" ]] && desc+=" for ${PLATFORM}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$desc"
|
echo "$desc"
|
||||||
|
@ -326,7 +326,7 @@ printEdition() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$edition" ] && result="$result $edition"
|
[ -n "$edition" ] && result+=" $edition"
|
||||||
|
|
||||||
echo "$result"
|
echo "$result"
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -167,10 +167,13 @@ abortInstall() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local iso="$2"
|
local iso="$2"
|
||||||
|
local efi
|
||||||
|
|
||||||
[[ "${iso,,}" == *".esd" ]] && exit 60
|
[[ "${iso,,}" == *".esd" ]] && exit 60
|
||||||
|
|
||||||
if [ ! -d "$dir/EFI" ]; then
|
efi=$(find "$dir" -maxdepth 1 -type d -iname efi | head -n 1)
|
||||||
|
|
||||||
|
if [ -z "$efi" ]; then
|
||||||
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
|
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -557,7 +560,7 @@ detectImage() {
|
||||||
|
|
||||||
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
||||||
language=$(getLanguage "$LANGUAGE" "desc")
|
language=$(getLanguage "$LANGUAGE" "desc")
|
||||||
desc="$desc ($language)"
|
desc=+" ($language)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
|
@ -669,7 +672,7 @@ addDriver() {
|
||||||
"win81x64"* ) folder="w8.1/amd64" ;;
|
"win81x64"* ) folder="w8.1/amd64" ;;
|
||||||
"win10x64"* ) folder="w10/amd64" ;;
|
"win10x64"* ) folder="w10/amd64" ;;
|
||||||
"win11x64"* ) folder="w11/amd64" ;;
|
"win11x64"* ) folder="w11/amd64" ;;
|
||||||
"win2025"* ) folder="2k22/amd64" ;;
|
"win2025"* ) folder="w11/amd64" ;;
|
||||||
"win2022"* ) folder="2k22/amd64" ;;
|
"win2022"* ) folder="2k22/amd64" ;;
|
||||||
"win2019"* ) folder="2k19/amd64" ;;
|
"win2019"* ) folder="2k19/amd64" ;;
|
||||||
"win2016"* ) folder="2k16/amd64" ;;
|
"win2016"* ) folder="2k16/amd64" ;;
|
||||||
|
|
39
src/mido.sh
39
src/mido.sh
|
@ -69,8 +69,11 @@ getESD() {
|
||||||
local fFile="products_filter.xml"
|
local fFile="products_filter.xml"
|
||||||
|
|
||||||
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
|
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
|
||||||
(( rc == 4 )) && error "Failed to download $winCatalog , network failure!" && return 1
|
|
||||||
(( rc != 0 )) && error "Failed to download $winCatalog , reason: $rc" && return 1
|
msg="Failed to download $winCatalog"
|
||||||
|
(( rc == 4 )) && error "$msg , network failure!" && return 1
|
||||||
|
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
|
||||||
|
(( rc != 0 )) && error "$msg , reason: $rc" && return 1
|
||||||
|
|
||||||
cd "$dir"
|
cd "$dir"
|
||||||
|
|
||||||
|
@ -148,8 +151,6 @@ verifyFile() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues"
|
error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues"
|
||||||
|
|
||||||
rm -f "$iso"
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,19 +173,19 @@ downloadFile() {
|
||||||
progress="--progress=dot:giga"
|
progress="--progress=dot:giga"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local msg="Downloading $desc..."
|
local msg="Downloading $desc"
|
||||||
html "$msg"
|
html "$msg..."
|
||||||
|
|
||||||
domain=$(echo "$url" | awk -F/ '{print $3}')
|
domain=$(echo "$url" | awk -F/ '{print $3}')
|
||||||
dots=$(echo "$domain" | tr -cd '.' | wc -c)
|
dots=$(echo "$domain" | tr -cd '.' | wc -c)
|
||||||
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
|
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
|
||||||
|
|
||||||
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
|
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
|
||||||
msg="Downloading $desc from $domain..."
|
msg="Downloading $desc from $domain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "$msg"
|
info "$msg..."
|
||||||
/run/progress.sh "$iso" "$size" "Downloading $desc ([P])..." &
|
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
|
||||||
|
|
||||||
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
|
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
|
||||||
|
|
||||||
|
@ -192,19 +193,18 @@ downloadFile() {
|
||||||
|
|
||||||
if (( rc == 0 )) && [ -f "$iso" ]; then
|
if (( rc == 0 )) && [ -f "$iso" ]; then
|
||||||
total=$(stat -c%s "$iso")
|
total=$(stat -c%s "$iso")
|
||||||
if [ "$total" -gt 100000000 ]; then
|
if [ "$total" -lt 100000000 ]; then
|
||||||
|
error "Downloaded ISO is only $total bytes?" && return 1
|
||||||
|
fi
|
||||||
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
|
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
|
||||||
html "Download finished successfully..." && return 0
|
html "Download finished successfully..." && return 0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if (( rc != 4 )); then
|
msg="Failed to download $url"
|
||||||
error "Failed to download $url , reason: $rc"
|
(( rc == 4 )) && error "$msg , network failure!" && return 1
|
||||||
else
|
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
|
||||||
error "Failed to download $url , network failure!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "$iso"
|
error "$msg , reason: $rc"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +220,7 @@ downloadImage() {
|
||||||
base=$(basename "$iso")
|
base=$(basename "$iso")
|
||||||
desc=$(fromFile "$base")
|
desc=$(fromFile "$base")
|
||||||
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
||||||
|
rm -f "$iso"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -235,7 +236,7 @@ downloadImage() {
|
||||||
desc=$(printEdition "$version" "$desc")
|
desc=$(printEdition "$version" "$desc")
|
||||||
error "The $language language version of $desc is not available, please switch to English." && return 1
|
error "The $language language version of $desc is not available, please switch to English." && return 1
|
||||||
fi
|
fi
|
||||||
desc="$desc in $language"
|
desc+=" in $language"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
switchEdition "$version"
|
switchEdition "$version"
|
||||||
|
@ -251,6 +252,7 @@ downloadImage() {
|
||||||
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
||||||
ISO="${ISO%.*}.esd"
|
ISO="${ISO%.*}.esd"
|
||||||
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
||||||
|
rm -f "$ISO"
|
||||||
ISO="$iso"
|
ISO="$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -268,6 +270,7 @@ downloadImage() {
|
||||||
size=$(getSize "$i" "$version" "$lang")
|
size=$(getSize "$i" "$version" "$lang")
|
||||||
sum=$(getHash "$i" "$version" "$lang")
|
sum=$(getHash "$i" "$version" "$lang")
|
||||||
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
|
rm -f "$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
|
@ -199,7 +199,7 @@ _graceful_shutdown() {
|
||||||
|
|
||||||
SERIAL="pty"
|
SERIAL="pty"
|
||||||
MONITOR="telnet:localhost:$QEMU_PORT,server,nowait,nodelay"
|
MONITOR="telnet:localhost:$QEMU_PORT,server,nowait,nodelay"
|
||||||
MONITOR="$MONITOR -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
|
MONITOR+=" -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
|
||||||
|
|
||||||
_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
|
_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue