Update mido.sh
This commit is contained in:
parent
33246afcd8
commit
16871990dd
1 changed files with 4 additions and 266 deletions
270
src/mido.sh
270
src/mido.sh
|
@ -242,10 +242,10 @@ download_windows_eval() {
|
|||
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Getting download link.."
|
||||
|
||||
if [[ "$enterprise_type" == "iot" ]]; then
|
||||
filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}"
|
||||
else
|
||||
filter="https://go.microsoft.com/fwlink/p/?LinkID=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}"
|
||||
filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}"
|
||||
|
||||
if ! echo "$iso_download_page_html" | grep -io "$filter" > /dev/null; then
|
||||
filter="https://go.microsoft.com/fwlink/p/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}"
|
||||
fi
|
||||
|
||||
iso_download_links=$(echo "$iso_download_page_html" | grep -io "$filter") || {
|
||||
|
@ -429,243 +429,6 @@ getCatalog() {
|
|||
return 0
|
||||
}
|
||||
|
||||
getMG() {
|
||||
|
||||
local version="$1"
|
||||
local lang="$2"
|
||||
local desc="$3"
|
||||
|
||||
local locale=""
|
||||
local culture=""
|
||||
local language=""
|
||||
local user_agent=""
|
||||
|
||||
user_agent=$(get_agent)
|
||||
language=$(getLanguage "$lang" "desc")
|
||||
culture=$(getLanguage "$lang" "culture")
|
||||
|
||||
local msg="Requesting download link from massgrave.dev..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
local pattern=""
|
||||
local locale="${culture,,}"
|
||||
local platform="${PLATFORM,,}"
|
||||
local url="https://massgrave.dev/"
|
||||
|
||||
if [[ "${PLATFORM,,}" != "arm64" ]]; then
|
||||
|
||||
case "${version,,}" in
|
||||
"win11${PLATFORM,,}" )
|
||||
url+="windows_11_links"
|
||||
pattern="consumer"
|
||||
;;
|
||||
"win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_11_links"
|
||||
pattern="business"
|
||||
;;
|
||||
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="11_enterprise_ltsc"
|
||||
;;
|
||||
"win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="11_iot"
|
||||
;;
|
||||
"win10${PLATFORM,,}" )
|
||||
url+="windows_10_links"
|
||||
pattern="consumer"
|
||||
;;
|
||||
"win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_10_links"
|
||||
pattern="business"
|
||||
;;
|
||||
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="10_enterprise_ltsc"
|
||||
;;
|
||||
"win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="10_iot"
|
||||
;;
|
||||
"win81${PLATFORM,,}-enterprise" | "win81${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_8.1_links"
|
||||
pattern="8.1_enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "sr" ]] && locale="sr-latn"
|
||||
;;
|
||||
"win2025" | "win2025-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2025"
|
||||
;;
|
||||
"win2022" | "win2022-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2022"
|
||||
;;
|
||||
"win2019" | "win2019-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2019"
|
||||
;;
|
||||
"win2016" | "win2016-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2016"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "hk" ]] && locale="ct"
|
||||
[[ "$locale" == "tw" ]] && locale="ct"
|
||||
;;
|
||||
"win2012r2" | "win2012r2-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2012_r2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win2008r2" | "win2008r2-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2008_r2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x64" | "win7x64-enterprise" )
|
||||
url+="windows_7_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x64-ultimate" )
|
||||
url+="windows_7_links"
|
||||
pattern="ultimate"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x86" | "win7x86-enterprise" )
|
||||
platform="x86"
|
||||
url+="windows_7_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x86-ultimate" )
|
||||
platform="x86"
|
||||
url+="windows_7_links"
|
||||
pattern="ultimate"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax64" | "winvistax64-enterprise" )
|
||||
url+="windows_vista_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax64-ultimate" )
|
||||
url+="windows_vista_links"
|
||||
pattern="sp2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax86" | "winvistax86-enterprise" )
|
||||
platform="x86"
|
||||
url+="windows_vista_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax86-ultimate" )
|
||||
platform="x86"
|
||||
url+="windows_vista_links"
|
||||
pattern="sp2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winxpx86" )
|
||||
platform="x86"
|
||||
url+="windows_xp_links"
|
||||
pattern="xp"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "pt" ]] && locale="pt-br"
|
||||
[[ "$locale" == "pp" ]] && locale="pt-pt"
|
||||
[[ "$locale" == "cn" ]] && locale="zh-hans"
|
||||
[[ "$locale" == "hk" ]] && locale="zh-hk"
|
||||
[[ "$locale" == "tw" ]] && locale="zh-tw"
|
||||
;;
|
||||
"winxpx64" )
|
||||
url+="windows_xp_links"
|
||||
pattern="xp"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case "${version,,}" in
|
||||
"win11${PLATFORM,,}" | "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="11_business"
|
||||
;;
|
||||
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="11_iot_enterprise_ltsc"
|
||||
;;
|
||||
"win10${PLATFORM,,}" | "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="Pro_10"
|
||||
locale="$language"
|
||||
[[ "$locale" == "Chinese" ]] && locale="ChnSimp"
|
||||
[[ "$locale" == "Chinese HK" ]] && locale="ChnTrad"
|
||||
[[ "$locale" == "Chinese TW" ]] && locale="ChnTrad"
|
||||
;;
|
||||
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="10_iot_enterprise_ltsc"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
local body=""
|
||||
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing product page: ${url}"
|
||||
body=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
||||
handle_curl_error "$?" "Massgrave"
|
||||
return $?
|
||||
}
|
||||
|
||||
local list=""
|
||||
list=$(echo "$body" | xmllint --html --nonet --xpath "//a[contains(text(), '.iso')]" - 2>/dev/null)
|
||||
|
||||
local result=""
|
||||
result=$(echo "$list" | grep -i "${platform}" | grep "${pattern}" | grep -i -m 1 "${locale,,}_")
|
||||
result=$(echo "$result" | sed -r 's/.*href="([^"]+).*/\1/g')
|
||||
local page="$result"
|
||||
|
||||
if [ -z "$page" ]; then
|
||||
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
||||
error "No download in the $language language available for $desc!"
|
||||
else
|
||||
error "Failed to parse download link for $desc! Please report this at $SUPPORT/issues."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${page}"
|
||||
result=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$url" --head --proto =https --tlsv1.2 --http1.1 -- "$page") || {
|
||||
handle_curl_error "$?" "Massgrave"
|
||||
return $?
|
||||
}
|
||||
|
||||
if [[ "${result,,}" == *"content-type: text"* ]]; then
|
||||
body=$(curl --silent --max-time 30 --user-agent "$user_agent" --referer "$url" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$page") || {
|
||||
handle_curl_error "$?" "Massgrave"
|
||||
return $?
|
||||
}
|
||||
|
||||
list=$(echo "$body" | xmllint --html --nonet --xpath "//a[contains(@href, '.iso')]" - 2>/dev/null)
|
||||
list=$(echo "$list" | sed -r 's/.*href="([^"]+).*/\1/g')
|
||||
page=$(echo "$list" | sed 's/&/\&/g;')
|
||||
|
||||
if [ -z "$page" ]; then
|
||||
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
||||
error "No download in the $language language available for $desc!"
|
||||
else
|
||||
error "Failed to parse download link for $desc! Please report this at $SUPPORT/issues."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MG_URL="$page"
|
||||
return 0
|
||||
}
|
||||
|
||||
getESD() {
|
||||
|
||||
local dir="$1"
|
||||
|
@ -950,31 +713,6 @@ downloadImage() {
|
|||
|
||||
done
|
||||
|
||||
if isMG "$version" "$lang"; then
|
||||
|
||||
if [[ "$tried" != "n" ]]; then
|
||||
info "Failed to download $desc, will try a diferent method now..."
|
||||
fi
|
||||
|
||||
tried="y"
|
||||
success="n"
|
||||
|
||||
if getMG "$version" "$lang" "$desc"; then
|
||||
success="y"
|
||||
else
|
||||
info "$msg" && html "$msg" && sleep "$delay"
|
||||
getMG "$version" "$lang" "$desc" && success="y"
|
||||
fi
|
||||
|
||||
if [[ "$success" == "y" ]]; then
|
||||
downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0
|
||||
info "$msg" && html "$msg" && sleep "$delay"
|
||||
downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0
|
||||
rm -f "$iso"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue