say_err "Architecture \`$machine_architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues"
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"
return1
fi
fi
echo"$architecture"
return0
}
# args:
# version or channel - $1
is_arm64_supported(){
# Extract the major version by splitting on the dot
major_version="${1%%.*}"
# Check if the major version is a valid number and less than 6
case"$major_version" in
[0-9]*)
if["$major_version" -lt 6];then
echo false
return0
fi
;;
esac
echo true
return0
}
# args:
# user_defined_os - $1
get_normalized_os(){
@ -357,8 +452,13 @@ get_normalized_os() {
echo"$osname"
return0
;;
macos)
osname='osx'
echo"$osname"
return0
;;
*)
say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, macos, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
return1
;;
esac
@ -401,6 +501,10 @@ get_normalized_channel() {
localchannel="$(to_lowercase "$1")"
if[[$channel== current ]];then
say_warning 'Value "Current" is deprecated for -Channel option. Use "STS" instead.'
fi
if[[$channel== release/* ]];then
say_warning 'Using branch name with -Channel option is no longer supported with newer releases. Use -Quality option with a channel in X.Y format instead.';
say "The remote and local file sizes are not equal. The remote file size is $remote_file_size bytes and the local size is $file_size bytes. The local package may be corrupted."
else
say "The remote and local file sizes are equal."
fi
fi
else
say "Either downloaded or local package size can not be measured. One of them may be corrupted."
download_error_msg="Unable to download $remote_path."
if[[$http_code != 2* ]];then
if[[ ! -z $http_code&&$http_code != 2* ]];then
download_error_msg+=" Returned HTTP status code: $http_code."
# wget exit code 4 stands for network-issue
elif[[$wget_result==4]];then
download_error_msg+=" Failed to reach the server: connection timeout."
fi
say_verbose "$download_error_msg"
return1
@ -1068,13 +1272,69 @@ downloadwget() {
return0
}
extract_stem(){
localurl="$1"
# extract the protocol
proto="$(echo$1| grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="${1/$proto/}"
# extract the path (if any) - since we know all of our feeds have a first path segment, we can skip the first one. otherwise we'd use -f2- to get the full path
# They all need to be 301, otherwise some links are broken (except for the last, which is not a redirect but 200 or 404).
broken_redirects=$(echo"$http_codes"| sed '$d'| grep -v '301')
# The response may end without final code 2xx/4xx/5xx somehow, e.g. network restrictions on www.bing.com causes redirecting to bing.com fails with connection refused.
# In this case it should not exclude the last.
last_http_code=$(echo"$http_codes"| tail -n 1)
if ! [[$last_http_code=~ ^(2|4|5)[0-9][0-9]$ ]];then
say_err "Quality and Version options are not allowed to be specified simultaneously. See https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for details."
echo" # Install a .NET SDK of a specific public version"
echo"$script_name [-v|--version <VERSION>]"
echo"$script_name -h|-?|--help"
echo""
echo"$script_name is a simple command line interface for obtaining dotnet cli."
echo" Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
echo" - The SDK needs to be installed without user interaction and without admin rights."
echo" - The SDK installation doesn't need to persist across multiple CI runs."
echo" To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer."
echo""
echo"Options:"
echo" -c,--channel <CHANNEL> Download from the channel specified, Defaults to \`$channel\`."
echo" -Channel"
echo" Possible values:"
echo" - Current - most current release"
echo" - LTS - most current supported release"
echo" - STS - the most recent Standard Term Support release"
echo" - LTS - the most recent Long Term Support release"
echo" - 2-part version in a format A.B - represents a specific release"
echo" examples: 2.0; 1.0"
echo" - 3-part version in a format A.B.Cxx - represents a specific SDK release"
echo" examples: 5.0.1xx, 5.0.2xx."
echo" Supported since 5.0 release"
echo" Warning: Value 'Current' is deprecated for the Channel parameter. Use 'STS' instead."
echo" Note: The version parameter overrides the channel parameter when any version other than 'latest' is used."
echo" -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
echo" -Version"
echo" Possible values:"
echo" - latest - most latest build on specific channel"
echo" - latest - the latest build on specific channel"
echo" - 3-part version in a format A.B.C - represents specific version of build"
echo" examples: 2.0.0-preview2-006120; 1.1.0"
echo" -q,--quality <quality> Download the latest build of specified quality in the channel."
echo" -Quality"
echo" The possible values are: daily, signed, validated, preview, GA."
echo" Works only in combination with channel. Not applicable for current and LTS channels and will be ignored if those channels are used."
echo" Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used."
echo" For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported."
echo" Supported since 5.0 release."
echo" Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality."
@ -1572,7 +1874,7 @@ do
echo" -InstallDir"
echo" --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
echo" --arch,-Architecture,-Arch"
echo" Possible values: x64, arm, and arm64"
echo" Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64"
echo" --os <system> Specifies operating system to be used when selecting the installer."
echo" Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6."
echo" In case any other value is provided, the platform will be determined by the script based on machine configuration."
@ -1597,6 +1899,8 @@ do
echo" --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly."
echo" --jsonfile <JSONFILE> Determines the SDK version from a user specified global.json file."
echo" Note: global.json must have a value for 'SDK:Version'"
echo" --keep-zip,-KeepZip If set, downloaded file is kept."
echo" --zip-path, -ZipPath If set, downloaded file is stored at the specified path."
echo" -?,--?,-h,--help,-Help Shows this help message"
echo""
echo"Install Location:"
@ -1615,10 +1919,10 @@ do
shift
done
say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
say "- The SDK needs to be installed without user interaction and without admin rights."
say "- The SDK installation doesn't need to persist across multiple CI runs."
say "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n"
say_verbose"Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
say_verbose"- The SDK needs to be installed without user interaction and without admin rights."
say_verbose"- The SDK installation doesn't need to persist across multiple CI runs."
say_verbose"To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n"
message="Provide credentials via --feed-credential parameter."
@ -1651,5 +1955,5 @@ else
fi
say "Note that the script does not resolve dependencies during installation."
say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
say "Installation finished successfully."
say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."