mirror of
https://github.com/dockur/windows.git
synced 2025-10-28 11:45:50 +00:00
fix: Improved download
This commit is contained in:
parent
26ec1de22b
commit
f5212897cd
1 changed files with 86 additions and 78 deletions
164
src/install.sh
164
src/install.sh
|
|
@ -386,7 +386,6 @@ startInstall() {
|
||||||
getESD() {
|
getESD() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local file="$2"
|
|
||||||
local winCatalog size
|
local winCatalog size
|
||||||
|
|
||||||
case "${VERSION,,}" in
|
case "${VERSION,,}" in
|
||||||
|
|
@ -449,12 +448,44 @@ getESD() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadImage() {
|
doMido() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
local url="$2"
|
local url="$2"
|
||||||
local rc=99
|
local desc="$3"
|
||||||
local msg desc progress
|
local rc
|
||||||
|
|
||||||
|
rm -f "$iso"
|
||||||
|
rm -f "$iso.PART"
|
||||||
|
|
||||||
|
local msg="Downloading $desc..."
|
||||||
|
info "$msg" && html "$msg"
|
||||||
|
/run/progress.sh "$iso.PART" "Downloading $desc ([P])..." &
|
||||||
|
|
||||||
|
cd "$TMP"
|
||||||
|
{ /run/mido.sh "$url"; rc=$?; } || :
|
||||||
|
cd /run
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
|
|
||||||
|
if (( rc == 0 )) && [ -f "$iso" ]; then
|
||||||
|
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
|
||||||
|
html "Download finished successfully..." && return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$iso"
|
||||||
|
rm -f "$iso.PART"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadFile() {
|
||||||
|
|
||||||
|
local iso="$1"
|
||||||
|
local url="$2"
|
||||||
|
local desc="$3"
|
||||||
|
local rc progress
|
||||||
|
|
||||||
rm -f "$iso"
|
rm -f "$iso"
|
||||||
|
|
||||||
|
|
@ -465,6 +496,32 @@ downloadImage() {
|
||||||
progress="--progress=dot:giga"
|
progress="--progress=dot:giga"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local msg="Downloading $desc..."
|
||||||
|
info "$msg" && html "$msg"
|
||||||
|
/run/progress.sh "$iso" "Downloading $desc ([P])..." &
|
||||||
|
|
||||||
|
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
|
|
||||||
|
if (( rc == 0 )) && [ -f "$iso" ]; then
|
||||||
|
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
|
||||||
|
html "Download finished successfully..." && return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$iso"
|
||||||
|
error "Failed to download $url , reason: $rc"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadImage() {
|
||||||
|
|
||||||
|
local iso="$1"
|
||||||
|
local url="$2"
|
||||||
|
local rc desc
|
||||||
|
|
||||||
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||||
|
|
||||||
desc=$(printVersion "$VERSION" "Windows")
|
desc=$(printVersion "$VERSION" "Windows")
|
||||||
|
|
@ -476,106 +533,57 @@ downloadImage() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||||
|
|
||||||
|
doMido "$iso" "$url" "$desc" && return 0
|
||||||
|
|
||||||
msg="Downloading $desc..."
|
if [[ "$VERSION" != "win10${PLATFORM,,}" ]] && [[ "$VERSION" != "win11${PLATFORM,,}" ]]; then
|
||||||
info "$msg" && html "$msg"
|
|
||||||
/run/progress.sh "$iso.PART" "Downloading $desc ([P])..." &
|
|
||||||
|
|
||||||
cd "$TMP"
|
|
||||||
{ /run/mido.sh "$url"; rc=$?; } || :
|
|
||||||
cd /run
|
|
||||||
|
|
||||||
fKill "progress.sh"
|
|
||||||
|
|
||||||
if (( rc == 0 )) && [ -f "$iso" ]; then
|
|
||||||
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
|
|
||||||
html "Download finished successfully..." && return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$VERSION" != "win10x64" ]] && [[ "$VERSION" != "win11x64" ]]; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Failed to download $desc using Mido, will try a different method now..."
|
info "Failed to download $desc using Mido, will try a different method now..."
|
||||||
|
|
||||||
rm -f "$iso"
|
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
mkdir -p "$TMP"
|
mkdir -p "$TMP"
|
||||||
|
|
||||||
rc=99
|
|
||||||
ISO="$TMP/$VERSION.esd"
|
ISO="$TMP/$VERSION.esd"
|
||||||
iso="$ISO"
|
iso="$ISO"
|
||||||
rm -f "$iso"
|
|
||||||
|
|
||||||
url=""
|
if ! getESD "$TMP/esd"; then
|
||||||
|
url=""
|
||||||
if getESD "$TMP/esd" "$iso"; then
|
else
|
||||||
url="$ESD_URL"
|
url="$ESD_URL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$url" ]; then
|
if [ -n "$url" ]; then
|
||||||
|
downloadFile "$iso" "$url" "$desc" && return 0
|
||||||
msg="Downloading $desc..."
|
|
||||||
info "$msg" && html "$msg"
|
|
||||||
/run/progress.sh "$iso" "Downloading $desc ([P])..." &
|
|
||||||
|
|
||||||
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
|
||||||
|
|
||||||
fKill "progress.sh"
|
|
||||||
|
|
||||||
if (( rc == 0 )) && [ -f "$iso" ]; then
|
|
||||||
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
|
|
||||||
html "Download finished successfully..." && return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
[[ "$EXTERNAL" == [Yy1]* ]] && return 1
|
||||||
|
|
||||||
case "${VERSION,,}" in
|
case "${VERSION,,}" in
|
||||||
"win11${PLATFORM,,}")
|
"win11${PLATFORM,,}")
|
||||||
url="https://dl.bobpony.com/windows/11/en-us_windows_11_23h2_${PLATFORM,,}.iso"
|
url="https://dl.bobpony.com/windows/11/en-us_windows_11_23h2_${PLATFORM,,}.iso"
|
||||||
;;
|
;;
|
||||||
"win10${PLATFORM,,}")
|
"win10${PLATFORM,,}")
|
||||||
url="https://dl.bobpony.com/windows/10/en-us_windows_10_22h2_${PLATFORM,,}.iso"
|
url="https://dl.bobpony.com/windows/10/en-us_windows_10_22h2_${PLATFORM,,}.iso"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
(( rc != 99 )) && error "Failed to download $url , reason: $rc"
|
return 1
|
||||||
return 1
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
|
||||||
|
|
||||||
info "Failed to download $desc from Microsoft, will try another mirror now..."
|
info "Failed to download $desc from Microsoft, will try another mirror now..."
|
||||||
|
|
||||||
rm -f "$iso"
|
rm -rf "$TMP"
|
||||||
rm -rf "$TMP"
|
mkdir -p "$TMP"
|
||||||
mkdir -p "$TMP"
|
|
||||||
|
|
||||||
ISO="$TMP/$BASE"
|
ISO="$TMP/$BASE"
|
||||||
iso="$ISO"
|
iso="$ISO"
|
||||||
rm -f "$iso"
|
|
||||||
|
|
||||||
msg="Downloading $desc..."
|
downloadFile "$iso" "$url" "$desc" && return 0
|
||||||
info "$msg" && html "$msg"
|
|
||||||
/run/progress.sh "$iso" "Downloading $desc ([P])..." &
|
|
||||||
|
|
||||||
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
|
||||||
|
|
||||||
fKill "progress.sh"
|
|
||||||
|
|
||||||
if (( rc == 0 )) && [ -f "$iso" ]; then
|
|
||||||
if [ $(stat -c%s "$iso") -gt 100000000 ]; then
|
|
||||||
html "Download finished successfully..." && return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
(( rc != 99 )) && error "Failed to download $url , reason: $rc"
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue