say_err "Architecture \`$machine_architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues"
#any channel or version that starts with the specified versions
# Extract the major version by splitting on the dot
case"$1" in
major_version="${1%%.*}"
("1"* |"2"* |"3"* |"4"* |"5"*)
# 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
echo false
return0
return0
fi
;;
esac
esac
echo true
echo true
@ -407,8 +452,13 @@ get_normalized_os() {
echo"$osname"
echo"$osname"
return0
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
return1
;;
;;
esac
esac
@ -451,6 +501,10 @@ get_normalized_channel() {
localchannel="$(to_lowercase "$1")"
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
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_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."
fi
}
# args:
# args:
# azure_feed - $1
# azure_feed - $1
# channel - $2
# channel - $2
@ -860,6 +956,37 @@ get_absolute_path() {
return0
return0
}
}
# args:
# override - $1 (boolean, true or false)
get_cp_options(){
eval$invocation
localoverride="$1"
localoverride_switch=""
if["$override"=false];then
override_switch="-n"
# create temporary files to check if 'cp -u' is supported
rm -f "$zip_path"&& say_verbose "Temporary zip file $zip_path was removed"
if[ -z ${keep_zip+x}];then
rm -f "$zip_path"&& say_verbose "Temporary archive file $zip_path was removed"
fi
if["$failed"=true];then
if["$failed"=true];then
say_err "Extraction failed"
say_err "Extraction failed"
@ -1124,13 +1272,69 @@ downloadwget() {
return0
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).
# 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')
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://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#options for details."
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"$script_name -h|-?|--help"
echo""
echo""
echo"$script_name is a simple command line interface for obtaining dotnet cli."
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""
echo"Options:"
echo"Options:"
echo" -c,--channel <CHANNEL> Download from the channel specified, Defaults to \`$channel\`."
echo" -c,--channel <CHANNEL> Download from the channel specified, Defaults to \`$channel\`."
echo" -Channel"
echo" -Channel"
echo" Possible values:"
echo" Possible values:"
echo" - Current - most current release"
echo" - STS - the most recent Standard Term Support release"
echo" - LTS - most current supported release"
echo" - LTS - the most recent Long Term Support release"
echo" - 2-part version in a format A.B - represents a specific release"
echo" - 2-part version in a format A.B - represents a specific release"
echo" examples: 2.0; 1.0"
echo" examples: 2.0; 1.0"
echo" - 3-part version in a format A.B.Cxx - represents a specific SDK release"
echo" - 3-part version in a format A.B.Cxx - represents a specific SDK release"
echo" examples: 5.0.1xx, 5.0.2xx."
echo" examples: 5.0.1xx, 5.0.2xx."
echo" Supported since 5.0 release"
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" 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" -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
echo" -Version"
echo" -Version"
@ -1626,7 +1863,7 @@ do
echo" -q,--quality <quality> Download the latest build of specified quality in the channel."
echo" -q,--quality <quality> Download the latest build of specified quality in the channel."
echo" -Quality"
echo" -Quality"
echo" The possible values are: daily, signed, validated, preview, GA."
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" 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" 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."
echo" Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality."
@ -1637,7 +1874,7 @@ do
echo" -InstallDir"
echo" -InstallDir"
echo" --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
echo" --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
echo" --arch,-Architecture,-Arch"
echo" --arch,-Architecture,-Arch"
echo" Possible values: x64, arm, arm64 and s390x"
echo" Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64"
echo" --os <system> Specifies operating system to be used when selecting the installer."
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" 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."
echo" In case any other value is provided, the platform will be determined by the script based on machine configuration."
@ -1662,6 +1899,8 @@ do
echo" --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly."
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" --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" 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" -?,--?,-h,--help,-Help Shows this help message"
echo""
echo""
echo"Install Location:"
echo"Install Location:"
@ -1680,10 +1919,10 @@ do
shift
shift
done
done
say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
say_verbose"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_verbose"- 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_verbose"- 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"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."
message="Provide credentials via --feed-credential parameter."
@ -1716,5 +1955,5 @@ else
fi
fi
say "Note that the script does not resolve dependencies during installation."
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 "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."