Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add languages to consumer & enterprise download #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions Mido.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ parse_args() {
;;
esac
done

if [ -z "$language" ]; then
language="English (United States)"
fi
}

handle_curl_error() {
Expand Down Expand Up @@ -360,7 +364,7 @@ consumer_download() {
}

# tr: Filter for only alphanumerics or "-" to prevent HTTP parameter injection
sku_id="$(echo "$language_skuid_table_html" | grep "English (United States)" | sed 's/"//g' | cut -d ',' -f 1 | cut -d ':' -f 2 | tr -cd '[:alnum:]-' | head -c 16)"
sku_id="$(echo "$language_skuid_table_html" | grep "$language" | sed 's/"//g' | cut -d ',' -f 1 | cut -d ':' -f 2 | tr -cd '[:alnum:]-' | head -c 16)"
[ "$VERBOSE" ] && echo "SKU ID: $sku_id" >&2

# Get ISO download link
Expand Down Expand Up @@ -423,13 +427,53 @@ enterprise_eval_download() {
return $?
}

case "$language" in
"English (Great Britain)")
CULTURE="en-gb"
COUNTRY="GB";;
"Chinese (Simplified)")
CULTURE="zh-cn"
COUNTRY="CN";;
"Chinese (Traditional)")
CULTURE="zh-tw"
COUNTRY="TW";;
"French")
CULTURE="fr-fr"
COUNTRY="FR";;
"German")
CULTURE="de-de"
COUNTRY="DE";;
"Italian")
CULTURE="it-it"
COUNTRY="IT";;
"Japanese")
CULTURE="ja-jp"
COUNTRY="JP";;
"Korean")
CULTURE="ko-kr"
COUNTRY="KR";;
"Portuguese (Brazil)")
CULTURE="pt-br"
COUNTRY="BR";;
"Spanish")
CULTURE="es-es"
COUNTRY="ES";;
"Russian")
CULTURE="ru-ru"
COUNTRY="RU";;
*)
CULTURE="en-us"
COUNTRY="US";;
esac


if ! [ "$iso_download_page_html" ]; then
# This should only happen if there's been some change to where this download page is located
echo_err "Windows enterprise evaluation download page gave us an empty response"
return 1
fi

iso_download_links="$(echo "$iso_download_page_html" | grep -o "https://go.microsoft.com/fwlink/p/?LinkID=[0-9]\+&clcid=0x[0-9a-z]\+&culture=en-us&country=US")" || {
iso_download_links="$(echo "$iso_download_page_html" | grep -o "https://go.microsoft.com/fwlink/p/?LinkID=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${CULTURE}&country=${COUNTRY}")" || {
# This should only happen if there's been some change to the download endpoint web address
echo_err "Windows enterprise evaluation download page gave us no download link"
return 1
Expand Down