2 # Copyright (c) .NET Foundation and contributors. All rights reserved.
3 # Licensed under the MIT license. See LICENSE file in the project root for full license information.
8 # Stop script if unbound variable found (use ${var:-} if intentional)
10 # By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success
11 # This is causing it to fail
14 # Use in the the functions: eval $invocation
15 invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"'
17 # standard output may be used as a return value in the functions
18 # we need a way to write text on the screen in the functions so that
19 # it won't interfere with the return value.
20 # Exposing stream 3 as a pipe to standard output of the script itself
23 # Setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors.
24 # See if stdout is a terminal
25 if [ -t 1 ] && command -v tput > /dev/null; then
26 # see if it supports colors
27 ncolors=$(tput colors)
28 if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
29 bold="$(tput bold || echo)"
30 normal="$(tput sgr0 || echo)"
31 black="$(tput setaf 0 || echo)"
32 red="$(tput setaf 1 || echo)"
33 green="$(tput setaf 2 || echo)"
34 yellow="$(tput setaf 3 || echo)"
35 blue="$(tput setaf 4 || echo)"
36 magenta="$(tput setaf 5 || echo)"
37 cyan="$(tput setaf 6 || echo)"
38 white="$(tput setaf 7 || echo)"
43 printf "%b\n" "${yellow:-}dotnet_install: Warning: $1${normal:-}"
47 printf "%b\n" "${red:-}dotnet_install: Error: $1${normal:-}" >&2
51 # using stream 3 (defined in the beginning) to not interfere with stdout of functions
52 # which may be used as return value
53 printf "%b\n" "${cyan:-}dotnet-install:${normal:-} $1" >&3
57 if [ "$verbose" = true ]; then
62 # This platform list is finite - if the SDK/Runtime has supported Linux distribution-specific assets,
63 # then and only then should the Linux distribution appear in this list.
64 # Adding a Linux distribution to this list does not imply distribution-specific support.
65 get_legacy_os_name_from_platform() {
138 get_linux_platform_name() {
141 if [ -n "$runtime_id" ]; then
142 echo "${runtime_id%-*}"
145 if [ -e /etc/os-release ]; then
147 echo "$ID${VERSION_ID:+.${VERSION_ID}}"
149 elif [ -e /etc/redhat-release ]; then
150 local redhatRelease=$(</etc/redhat-release)
151 if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux "*" release 6."* ]]; then
158 say_verbose "Linux specific platform name and version could not be detected: UName = $uname"
162 is_musl_based_distro() {
163 (ldd --version 2>&1 || true) | grep -q musl
166 get_current_os_name() {
170 if [ "$uname" = "Darwin" ]; then
173 elif [ "$uname" = "FreeBSD" ]; then
176 elif [ "$uname" = "Linux" ]; then
177 local linux_platform_name
178 linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
180 if [ "$linux_platform_name" = "rhel.6" ]; then
181 echo $linux_platform_name
183 elif is_musl_based_distro; then
192 say_err "OS name could not be detected: UName = $uname"
196 get_legacy_os_name() {
200 if [ "$uname" = "Darwin" ]; then
203 elif [ -n "$runtime_id" ]; then
204 echo $(get_legacy_os_name_from_platform "${runtime_id%-*}" || echo "${runtime_id%-*}")
207 if [ -e /etc/os-release ]; then
209 os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "")
210 if [ -n "$os" ]; then
217 say_verbose "Distribution specific OS name and version could not be detected: UName = $uname"
224 hash "$1" > /dev/null 2>&1
230 local hasMinimum=false
231 if machine_has "curl"; then
233 elif machine_has "wget"; then
237 if [ "$hasMinimum" = "false" ]; then
238 say_err "curl (recommended) or wget are required to download dotnet. Install missing prerequisite to proceed."
247 if [ "${DOTNET_INSTALL_SKIP_PREREQS:-}" = "1" ]; then
251 if [ "$(uname)" = "Linux" ]; then
252 if is_musl_based_distro; then
253 if ! command -v scanelf > /dev/null; then
254 say_warning "scanelf not found, please install pax-utils package."
257 LDCONFIG_COMMAND="scanelf --ldpath -BF '%f'"
258 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libintl)" ] && say_warning "Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)."
260 if [ ! -x "$(command -v ldconfig)" ]; then
261 say_verbose "ldconfig is not in PATH, trying /sbin/ldconfig."
262 LDCONFIG_COMMAND="/sbin/ldconfig"
264 LDCONFIG_COMMAND="ldconfig"
266 local librarypath=${LD_LIBRARY_PATH:-}
267 LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
270 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep zlib)" ] && say_warning "Unable to locate zlib. Probable prerequisite missing; install zlib."
271 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep ssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
272 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu."
273 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep lttng)" ] && say_warning "Unable to locate liblttng. Probable prerequisite missing; install libcurl."
274 [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libcurl)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
285 echo "$1" | tr '[:upper:]' '[:lower:]'
291 remove_trailing_slash() {
301 remove_beginning_slash() {
311 # child_path - $2 - this parameter can be empty
315 # TODO: Consider making it work with any number of paths. For now:
316 if [ ! -z "${3:-}" ]; then
317 say_err "combine_paths: Function takes two parameters."
321 local root_path="$(remove_trailing_slash "$1")"
322 local child_path="$(remove_beginning_slash "${2:-}")"
323 say_verbose "combine_paths: root_path=$root_path"
324 say_verbose "combine_paths: child_path=$child_path"
325 echo "$root_path/$child_path"
329 get_machine_architecture() {
332 if command -v uname > /dev/null; then
346 # Always default to 'x64'
353 get_normalized_architecture_from_architecture() {
356 local architecture="$(to_lowercase "$1")"
357 case "$architecture" in
359 echo "$(get_normalized_architecture_from_architecture "$(get_machine_architecture)")"
376 say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues"
380 # The version text returned from the feeds is a 1-line or 2-line string:
381 # For the SDK and the dotnet runtime (2 lines):
382 # Line 1: # commit_hash
383 # Line 2: # 4-part version
384 # For the aspnetcore runtime (1 line):
385 # Line 1: # 4-part version
388 # version_text - stdin
389 get_version_from_version_info() {
392 cat | tail -n 1 | sed 's/\r$//'
398 # relative_path_to_package - $2
399 # specific_version - $3
400 is_dotnet_package_installed() {
403 local install_root="$1"
404 local relative_path_to_package="$2"
405 local specific_version="${3//[$'\t\r\n']}"
407 local dotnet_package_path="$(combine_paths "$(combine_paths "$install_root" "$relative_path_to_package")" "$specific_version")"
408 say_verbose "is_dotnet_package_installed: dotnet_package_path=$dotnet_package_path"
410 if [ -d "$dotnet_package_path" ]; then
420 # normalized_architecture - $3
422 get_latest_version_info() {
425 local azure_feed="$1"
427 local normalized_architecture="$3"
430 local version_file_url=null
431 if [[ "$runtime" == "dotnet" ]]; then
432 version_file_url="$uncached_feed/Runtime/$channel/latest.version"
433 elif [[ "$runtime" == "aspnetcore" ]]; then
434 version_file_url="$uncached_feed/aspnetcore/Runtime/$channel/latest.version"
435 elif [ -z "$runtime" ]; then
436 if [ "$coherent" = true ]; then
437 version_file_url="$uncached_feed/Sdk/$channel/latest.coherent.version"
439 version_file_url="$uncached_feed/Sdk/$channel/latest.version"
442 say_err "Invalid value for \$runtime"
445 say_verbose "get_latest_version_info: latest url: $version_file_url"
447 download "$version_file_url"
453 parse_jsonfile_for_version() {
457 if [ ! -f "$json_file" ]; then
458 say_err "Unable to find \`$json_file\`"
462 sdk_section=$(cat $json_file | awk '/"sdk"/,/}/')
463 if [ -z "$sdk_section" ]; then
464 say_err "Unable to parse the SDK node in \`$json_file\`"
468 sdk_list=$(echo $sdk_section | awk -F"[{}]" '{print $2}')
469 sdk_list=${sdk_list//[\" ]/}
470 sdk_list=${sdk_list//,/$'\n'}
471 sdk_list="$(echo -e "${sdk_list}" | tr -d '[[:space:]]')"
473 local version_info=""
474 while read -r line; do
476 while read -r key value; do
477 if [[ "$key" == "version" ]]; then
482 if [ -z "$version_info" ]; then
483 say_err "Unable to find the SDK:version node in \`$json_file\`"
495 # normalized_architecture - $3
498 get_specific_version_from_version() {
501 local azure_feed="$1"
503 local normalized_architecture="$3"
504 local version="$(to_lowercase "$4")"
507 if [ -z "$json_file" ]; then
511 version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1
512 say_verbose "get_specific_version_from_version: version_info=$version_info"
513 echo "$version_info" | get_version_from_version_info
518 version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" true)" || return 1
519 say_verbose "get_specific_version_from_version: version_info=$version_info"
520 echo "$version_info" | get_version_from_version_info
530 version_info="$(parse_jsonfile_for_version "$json_file")" || return 1
539 # normalized_architecture - $3
540 # specific_version - $4
541 construct_download_link() {
544 local azure_feed="$1"
546 local normalized_architecture="$3"
547 local specific_version="${4//[$'\t\r\n']}"
550 osname="$(get_current_os_name)" || return 1
552 local download_link=null
553 if [[ "$runtime" == "dotnet" ]]; then
554 download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
555 elif [[ "$runtime" == "aspnetcore" ]]; then
556 download_link="$azure_feed/aspnetcore/Runtime/$specific_version/aspnetcore-runtime-$specific_version-$osname-$normalized_architecture.tar.gz"
557 elif [ -z "$runtime" ]; then
558 download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_version-$osname-$normalized_architecture.tar.gz"
563 echo "$download_link"
570 # normalized_architecture - $3
571 # specific_version - $4
572 construct_legacy_download_link() {
575 local azure_feed="$1"
577 local normalized_architecture="$3"
578 local specific_version="${4//[$'\t\r\n']}"
580 local distro_specific_osname
581 distro_specific_osname="$(get_legacy_os_name)" || return 1
583 local legacy_download_link=null
584 if [[ "$runtime" == "dotnet" ]]; then
585 legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
586 elif [ -z "$runtime" ]; then
587 legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
592 echo "$legacy_download_link"
596 get_user_install_path() {
599 if [ ! -z "${DOTNET_INSTALL_DIR:-}" ]; then
600 echo "$DOTNET_INSTALL_DIR"
609 resolve_installation_path() {
613 if [ "$install_dir" = "<auto>" ]; then
614 local user_install_path="$(get_user_install_path)"
615 say_verbose "resolve_installation_path: user_install_path=$user_install_path"
616 echo "$user_install_path"
625 # relative_or_absolute_path - $1
626 get_absolute_path() {
629 local relative_or_absolute_path=$1
630 echo "$(cd "$(dirname "$1")" && pwd -P)/$(basename "$1")"
635 # input_files - stdin
639 copy_files_or_dirs_from_list() {
642 local root_path="$(remove_trailing_slash "$1")"
643 local out_path="$(remove_trailing_slash "$2")"
645 local osname="$(get_current_os_name)"
646 local override_switch=$(
647 if [ "$override" = false ]; then
648 if [ "$osname" = "linux-musl" ]; then
655 cat | uniq | while read -r file_path; do
656 local path="$(remove_beginning_slash "${file_path#$root_path}")"
657 local target="$out_path/$path"
658 if [ "$override" = true ] || (! ([ -d "$target" ] || [ -e "$target" ])); then
659 mkdir -p "$out_path/$(dirname "$path")"
660 if [ -d "$target" ]; then
663 cp -R $override_switch "$root_path/$path" "$target"
671 extract_dotnet_package() {
677 local temp_out_path="$(mktemp -d "$temporary_file_template")"
680 tar -xzf "$zip_path" -C "$temp_out_path" > /dev/null || failed=true
682 local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/'
683 find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false
684 find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files"
686 rm -rf "$temp_out_path"
688 if [ "$failed" = true ]; then
689 say_err "Extraction failed"
696 # [out_path] - $2 - stdout if not provided
700 local remote_path="$1"
701 local out_path="${2:-}"
703 if [[ "$remote_path" != "http"* ]]; then
704 cp "$remote_path" "$out_path"
709 if machine_has "curl"; then
710 downloadcurl "$remote_path" "$out_path" || failed=true
711 elif machine_has "wget"; then
712 downloadwget "$remote_path" "$out_path" || failed=true
716 if [ "$failed" = true ]; then
717 say_verbose "Download failed: $remote_path"
725 local remote_path="$1"
726 local out_path="${2:-}"
728 # Append feed_credential as late as possible before calling curl to avoid logging feed_credential
729 remote_path="${remote_path}${feed_credential}"
732 if [ -z "$out_path" ]; then
733 curl --retry 10 -sSL -f --create-dirs "$remote_path" || failed=true
735 curl --retry 10 -sSL -f --create-dirs -o "$out_path" "$remote_path" || failed=true
737 if [ "$failed" = true ]; then
738 say_verbose "Curl download failed"
746 local remote_path="$1"
747 local out_path="${2:-}"
749 # Append feed_credential as late as possible before calling wget to avoid logging feed_credential
750 remote_path="${remote_path}${feed_credential}"
753 if [ -z "$out_path" ]; then
754 wget -q --tries 10 -O - "$remote_path" || failed=true
756 wget --tries 10 -O "$out_path" "$remote_path" || failed=true
758 if [ "$failed" = true ]; then
759 say_verbose "Wget download failed"
767 valid_legacy_download_link=true
769 normalized_architecture="$(get_normalized_architecture_from_architecture "$architecture")"
770 say_verbose "normalized_architecture=$normalized_architecture"
772 specific_version="$(get_specific_version_from_version "$azure_feed" "$channel" "$normalized_architecture" "$version" "$json_file")"
773 say_verbose "specific_version=$specific_version"
774 if [ -z "$specific_version" ]; then
775 say_err "Could not resolve version information."
779 download_link="$(construct_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")"
780 say_verbose "Constructed primary named payload URL: $download_link"
782 legacy_download_link="$(construct_legacy_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")" || valid_legacy_download_link=false
784 if [ "$valid_legacy_download_link" = true ]; then
785 say_verbose "Constructed legacy named payload URL: $legacy_download_link"
787 say_verbose "Cound not construct a legacy_download_link; omitting..."
790 install_root="$(resolve_installation_path "$install_dir")"
791 say_verbose "InstallRoot: $install_root"
796 local download_failed=false
798 local asset_relative_path=''
800 if [[ "$runtime" == "dotnet" ]]; then
801 asset_relative_path="shared/Microsoft.NETCore.App"
802 asset_name=".NET Core Runtime"
803 elif [[ "$runtime" == "aspnetcore" ]]; then
804 asset_relative_path="shared/Microsoft.AspNetCore.App"
805 asset_name="ASP.NET Core Runtime"
806 elif [ -z "$runtime" ]; then
807 asset_relative_path="sdk"
808 asset_name=".NET Core SDK"
810 say_err "Invalid value for \$runtime"
814 # Check if the SDK version is already installed.
815 if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
816 say "$asset_name version $specific_version is already installed."
820 mkdir -p "$install_root"
821 zip_path="$(mktemp "$temporary_file_template")"
822 say_verbose "Zip path: $zip_path"
824 say "Downloading link: $download_link"
826 # Failures are normal in the non-legacy case for ultimately legacy downloads.
827 # Do not output to stderr, since output to stderr is considered an error.
828 download "$download_link" "$zip_path" 2>&1 || download_failed=true
830 # if the download fails, download the legacy_download_link
831 if [ "$download_failed" = true ]; then
832 say "Cannot download: $download_link"
834 if [ "$valid_legacy_download_link" = true ]; then
835 download_failed=false
836 download_link="$legacy_download_link"
837 zip_path="$(mktemp "$temporary_file_template")"
838 say_verbose "Legacy zip path: $zip_path"
839 say "Downloading legacy link: $download_link"
840 download "$download_link" "$zip_path" 2>&1 || download_failed=true
842 if [ "$download_failed" = true ]; then
843 say "Cannot download: $download_link"
848 if [ "$download_failed" = true ]; then
849 say_err "Could not find/download: \`$asset_name\` with version = $specific_version"
850 say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support"
854 say "Extracting zip from $download_link"
855 extract_dotnet_package "$zip_path" "$install_root"
857 # Check if the SDK version is installed; if not, fail the installation.
858 # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
859 if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then
861 read -ra verArr <<< "$specific_version"
862 release_version="${verArr[0]}"
864 say_verbose "Checking installation: version = $release_version"
865 if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then
870 # Check if the standard SDK version is installed.
871 say_verbose "Checking installation: version = $specific_version"
872 if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then
876 say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
882 local_version_file_relative_path="/.version"
883 bin_folder_relative_path=""
884 temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX"
890 architecture="<auto>"
894 azure_feed="https://dotnetcli.azureedge.net/dotnet"
895 uncached_feed="https://dotnetcli.blob.core.windows.net/dotnet"
900 override_non_versioned_files=true
901 non_dynamic_parameters=""
907 -c|--channel|-[Cc]hannel)
911 -v|--version|-[Vv]ersion)
915 -i|--install-dir|-[Ii]nstall[Dd]ir)
919 --arch|--architecture|-[Aa]rch|-[Aa]rchitecture)
923 --shared-runtime|-[Ss]hared[Rr]untime)
924 say_warning "The --shared-runtime flag is obsolete and may be removed in a future version of this script. The recommended usage is to specify '--runtime dotnet'."
925 if [ -z "$runtime" ]; then
929 --runtime|-[Rr]untime)
932 if [[ "$runtime" != "dotnet" ]] && [[ "$runtime" != "aspnetcore" ]]; then
933 say_err "Unsupported value for --runtime: '$1'. Valid values are 'dotnet' and 'aspnetcore'."
934 if [[ "$runtime" == "windowsdesktop" ]]; then
935 say_err "WindowsDesktop archives are manufactured for Windows platforms only."
940 --dry-run|-[Dd]ry[Rr]un)
943 --no-path|-[Nn]o[Pp]ath)
945 non_dynamic_parameters+=" $name"
947 --verbose|-[Vv]erbose)
949 non_dynamic_parameters+=" $name"
951 --no-cdn|-[Nn]o[Cc]dn)
953 non_dynamic_parameters+=" $name"
955 --azure-feed|-[Aa]zure[Ff]eed)
958 non_dynamic_parameters+=" $name "\""$1"\"""
960 --uncached-feed|-[Uu]ncached[Ff]eed)
963 non_dynamic_parameters+=" $name "\""$1"\"""
965 --feed-credential|-[Ff]eed[Cc]redential)
968 non_dynamic_parameters+=" $name "\""$1"\"""
970 --runtime-id|-[Rr]untime[Ii]d)
973 non_dynamic_parameters+=" $name "\""$1"\"""
975 --jsonfile|-[Jj][Ss]on[Ff]ile)
979 --skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles)
980 override_non_versioned_files=false
981 non_dynamic_parameters+=" $name"
983 -?|--?|-h|--help|-[Hh]elp)
984 script_name="$(basename "$0")"
985 echo ".NET Tools Installer"
986 echo "Usage: $script_name [-c|--channel <CHANNEL>] [-v|--version <VERSION>] [-p|--prefix <DESTINATION>]"
987 echo " $script_name -h|-?|--help"
989 echo "$script_name is a simple command line interface for obtaining dotnet cli."
992 echo " -c,--channel <CHANNEL> Download from the channel specified, Defaults to \`$channel\`."
994 echo " Possible values:"
995 echo " - Current - most current release"
996 echo " - LTS - most current supported release"
997 echo " - 2-part version in a format A.B - represents a specific release"
998 echo " examples: 2.0; 1.0"
999 echo " - Branch name"
1000 echo " examples: release/2.0.0; Master"
1001 echo " Note: The version parameter overrides the channel parameter."
1002 echo " -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
1004 echo " Possible values:"
1005 echo " - latest - most latest build on specific channel"
1006 echo " - coherent - most latest coherent build on specific channel"
1007 echo " coherent applies only to SDK downloads"
1008 echo " - 3-part version in a format A.B.C - represents specific version of build"
1009 echo " examples: 2.0.0-preview2-006120; 1.1.0"
1010 echo " -i,--install-dir <DIR> Install under specified location (see Install Location below)"
1012 echo " --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
1013 echo " --arch,-Architecture,-Arch"
1014 echo " Possible values: x64, arm, and arm64"
1015 echo " --runtime <RUNTIME> Installs a shared runtime only, without the SDK."
1017 echo " Possible values:"
1018 echo " - dotnet - the Microsoft.NETCore.App shared runtime"
1019 echo " - aspnetcore - the Microsoft.AspNetCore.App shared runtime"
1020 echo " --dry-run,-DryRun Do not perform installation. Display download link."
1021 echo " --no-path, -NoPath Do not set PATH for the current process."
1022 echo " --verbose,-Verbose Display diagnostics information."
1023 echo " --azure-feed,-AzureFeed Azure feed location. Defaults to $azure_feed, This parameter typically is not changed by the user."
1024 echo " --uncached-feed,-UncachedFeed Uncached feed location. This parameter typically is not changed by the user."
1025 echo " --feed-credential,-FeedCredential Azure feed shared access token. This parameter typically is not specified."
1026 echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable."
1027 echo " -SkipNonVersionedFiles"
1028 echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly."
1029 echo " --jsonfile <JSONFILE> Determines the SDK version from a user specified global.json file."
1030 echo " Note: global.json must have a value for 'SDK:Version'"
1031 echo " --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)."
1033 echo " -?,--?,-h,--help,-Help Shows this help message"
1035 echo "Obsolete parameters:"
1036 echo " --shared-runtime The recommended alternative is '--runtime dotnet'."
1037 echo " This parameter is obsolete and may be removed in a future version of this script."
1038 echo " Installs just the shared runtime bits, not the entire SDK."
1040 echo "Install Location:"
1041 echo " Location is chosen in following order:"
1042 echo " - --install-dir option"
1043 echo " - Environmental variable DOTNET_INSTALL_DIR"
1044 echo " - $HOME/.dotnet"
1048 say_err "Unknown argument \`$name\`"
1056 if [ "$no_cdn" = true ]; then
1057 azure_feed="$uncached_feed"
1062 script_name=$(basename "$0")
1064 if [ "$dry_run" = true ]; then
1066 say "Primary named payload URL: $download_link"
1067 if [ "$valid_legacy_download_link" = true ]; then
1068 say "Legacy named payload URL: $legacy_download_link"
1070 repeatable_command="./$script_name --version "\""$specific_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"""
1071 if [[ "$runtime" == "dotnet" ]]; then
1072 repeatable_command+=" --runtime "\""dotnet"\"""
1073 elif [[ "$runtime" == "aspnetcore" ]]; then
1074 repeatable_command+=" --runtime "\""aspnetcore"\"""
1076 repeatable_command+="$non_dynamic_parameters"
1077 say "Repeatable invocation: $repeatable_command"
1084 bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")"
1085 if [ "$no_path" = false ]; then
1086 say "Adding to current process PATH: \`$bin_path\`. Note: This change will be visible only when sourcing script."
1087 export PATH="$bin_path":"$PATH"
1089 say "Binaries of dotnet can be found in $bin_path"
1092 say "Installation finished successfully."