mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 03:15:49 +00:00
feat: Validate download links
This commit is contained in:
parent
049c36ff83
commit
d517a9c236
1 changed files with 17 additions and 20 deletions
37
src/mido.sh
37
src/mido.sh
|
|
@ -271,16 +271,9 @@ download_windows_eval() {
|
|||
iso_download_link=$(echo "$iso_download_links" | head -n 1)
|
||||
else
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 4 | tail -n 1)
|
||||
fi
|
||||
[[ "${iso_download_link,,}" != *"x64"* ]] && iso_download_link="" ;;
|
||||
"arm64" )
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1)
|
||||
if [[ "${iso_download_link,,}" != *"a64"* ]]; then
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Link for ARM platform currently not available!"
|
||||
return 1
|
||||
fi ;;
|
||||
* )
|
||||
error "Invalid platform specified, value \"$PLATFORM\" is not recognized!" && return 1 ;;
|
||||
"arm64" )
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) ;;
|
||||
esac ;;
|
||||
"enterprise" )
|
||||
case "${PLATFORM,,}" in
|
||||
|
|
@ -289,23 +282,14 @@ download_windows_eval() {
|
|||
iso_download_link=$(echo "$iso_download_links" | head -n 1)
|
||||
else
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1)
|
||||
fi
|
||||
[[ "${iso_download_link,,}" != *"x64"* ]] && iso_download_link="" ;;
|
||||
"arm64" )
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1)
|
||||
if [[ "${iso_download_link,,}" != *"a64"* ]]; then
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Link for ARM platform currently not available!"
|
||||
return 1
|
||||
fi ;;
|
||||
* )
|
||||
error "Invalid platform specified, value \"$PLATFORM\" is not recognized!" && return 1 ;;
|
||||
"arm64" )
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 2 | tail -n 1) ;;
|
||||
esac ;;
|
||||
"server" )
|
||||
case "${PLATFORM,,}" in
|
||||
"x64" )
|
||||
iso_download_link=$(echo "$iso_download_links" | head -n 1) ;;
|
||||
* )
|
||||
error "Invalid platform specified, value \"$PLATFORM\" is not recognized!" && return 1 ;;
|
||||
esac ;;
|
||||
* )
|
||||
error "Invalid type specified, value \"$enterprise_type\" is not recognized!" && return 1 ;;
|
||||
|
|
@ -323,6 +307,19 @@ download_windows_eval() {
|
|||
return $?
|
||||
}
|
||||
|
||||
case "${PLATFORM,,}" in
|
||||
"x64" )
|
||||
if [[ "${iso_download_link,,}" != *"x64"* ]]; then
|
||||
error "Download link is for the wrong platform? Please report this at $SUPPORT/issues"
|
||||
return 1
|
||||
fi ;;
|
||||
"arm64" )
|
||||
if [[ "${iso_download_link,,}" != *"a64"* ]]; then
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Link for ARM platform currently not available!"
|
||||
return 1
|
||||
fi ;;
|
||||
esac ;;
|
||||
|
||||
MIDO_URL="$iso_download_link"
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue