updated installers

This commit is contained in:
Evgenii Korolevskii 2022-09-19 20:18:24 +02:00
parent 5d7bc0454b
commit 251997c37d
1 changed files with 45 additions and 3 deletions

View File

@ -353,6 +353,48 @@ get_normalized_architecture_from_architecture() {
return 1 return 1
} }
# args:
# version - $1
# channel - $2
# architecture - $3
get_normalized_architecture_for_specific_sdk_version() {
eval $invocation
local is_version_support_arm64="$(is_arm64_supported "$1")"
local is_channel_support_arm64="$(is_arm64_supported "$2")"
local architecture="$3";
local osname="$(get_current_os_name)"
if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then
#check if rosetta is installed
if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then
say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64."
echo "x64"
return 0;
else
say_err "Architecture \`$architecture\` is not supported for .NET SDK version \`$version\`. Please install Rosetta to allow emulation of the \`$architecture\` .NET SDK on this platform"
return 1
fi
fi
echo "$architecture"
return 0
}
# args:
# version or channel - $1
is_arm64_supported() {
#any channel or version that starts with the specified versions
case "$1" in
( "1"* | "2"* | "3"* | "4"* | "5"*)
echo false
return 0
esac
echo true
return 0
}
# args: # args:
# user_defined_os - $1 # user_defined_os - $1
get_normalized_os() { get_normalized_os() {
@ -523,7 +565,7 @@ parse_globaljson_file_for_version() {
return 1 return 1
fi fi
sdk_section=$(cat $json_file | awk '/"sdk"/,/}/') sdk_section=$(cat $json_file | tr -d "\r" | awk '/"sdk"/,/}/')
if [ -z "$sdk_section" ]; then if [ -z "$sdk_section" ]; then
say_err "Unable to parse the SDK node in \`$json_file\`" say_err "Unable to parse the SDK node in \`$json_file\`"
return 1 return 1
@ -988,8 +1030,6 @@ download() {
sleep $((attempts*10)) sleep $((attempts*10))
done done
if [ "$failed" = true ]; then if [ "$failed" = true ]; then
say_verbose "Download failed: $remote_path" say_verbose "Download failed: $remote_path"
return 1 return 1
@ -1346,6 +1386,8 @@ calculate_vars() {
install_root="$(resolve_installation_path "$install_dir")" install_root="$(resolve_installation_path "$install_dir")"
say_verbose "InstallRoot: '$install_root'." say_verbose "InstallRoot: '$install_root'."
normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")"
if [[ "$runtime" == "dotnet" ]]; then if [[ "$runtime" == "dotnet" ]]; then
asset_relative_path="shared/Microsoft.NETCore.App" asset_relative_path="shared/Microsoft.NETCore.App"
asset_name=".NET Core Runtime" asset_name=".NET Core Runtime"