Skip to content

Commit 65e2252

Browse files
author
github-actions
committed
Automated dotnet-install script update
1 parent e3e3ed7 commit 65e2252

2 files changed

Lines changed: 34 additions & 176 deletions

File tree

src/dotnet/scripts/vendor/dotnet-install.sh

Lines changed: 17 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ get_normalized_quality() {
477477
local quality="$(to_lowercase "$1")"
478478
if [ ! -z "$quality" ]; then
479479
case "$quality" in
480-
daily | signed | validated | preview)
480+
daily | preview)
481481
echo "$quality"
482482
return 0
483483
;;
@@ -486,7 +486,7 @@ get_normalized_quality() {
486486
return 0
487487
;;
488488
*)
489-
say_err "'$quality' is not a supported value for --quality option. Supported values are: daily, signed, validated, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
489+
say_err "'$quality' is not a supported value for --quality option. Supported values are: daily, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
490490
return 1
491491
;;
492492
esac
@@ -1198,13 +1198,19 @@ downloadcurl() {
11981198
local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs "
11991199
local curl_exit_code=0;
12001200
if [ -z "$out_path" ]; then
1201-
curl $curl_options "$remote_path_with_credential" 2>&1
1201+
curl_output=$(curl $curl_options "$remote_path_with_credential" 2>&1)
12021202
curl_exit_code=$?
1203+
echo "$curl_output"
12031204
else
1204-
curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1
1205+
curl_output=$(curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1)
12051206
curl_exit_code=$?
12061207
fi
1207-
1208+
1209+
# Regression in curl causes curl with --retry to return a 0 exit code even when it fails to download a file - https://github.com/curl/curl/issues/17554
1210+
if [ $curl_exit_code -eq 0 ] && echo "$curl_output" | grep -q "^curl: ([0-9]*) "; then
1211+
curl_exit_code=$(echo "$curl_output" | sed 's/curl: (\([0-9]*\)).*/\1/')
1212+
fi
1213+
12081214
if [ $curl_exit_code -gt 0 ]; then
12091215
download_error_msg="Unable to download $remote_path."
12101216
# Check for curl timeout codes
@@ -1272,61 +1278,6 @@ downloadwget() {
12721278
return 0
12731279
}
12741280

1275-
extract_stem() {
1276-
local url="$1"
1277-
# extract the protocol
1278-
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
1279-
# remove the protocol
1280-
url="${1/$proto/}"
1281-
# 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
1282-
full_path="$(echo $url | grep / | cut -d/ -f2-)"
1283-
path="$(echo $full_path | cut -d/ -f2-)"
1284-
echo $path
1285-
}
1286-
1287-
check_url_exists() {
1288-
eval $invocation
1289-
local url="$1"
1290-
1291-
local code=""
1292-
if machine_has "curl"
1293-
then
1294-
code=$(curl --head -o /dev/null -w "%{http_code}" -s --fail "$url");
1295-
elif machine_has "wget"
1296-
then
1297-
# get the http response, grab the status code
1298-
server_response=$(wget -qO- --method=HEAD --server-response "$url" 2>&1)
1299-
code=$(echo "$server_response" | grep "HTTP/" | awk '{print $2}')
1300-
fi
1301-
if [ $code = "200" ]; then
1302-
return 0
1303-
else
1304-
return 1
1305-
fi
1306-
}
1307-
1308-
sanitize_redirect_url() {
1309-
eval $invocation
1310-
1311-
local url_stem
1312-
url_stem=$(extract_stem "$1")
1313-
say_verbose "Checking configured feeds for the asset at ${yellow:-}$url_stem${normal:-}"
1314-
1315-
for feed in "${feeds[@]}"
1316-
do
1317-
local trial_url="$feed/$url_stem"
1318-
say_verbose "Checking ${yellow:-}$trial_url${normal:-}"
1319-
if check_url_exists "$trial_url"; then
1320-
say_verbose "Found a match at ${yellow:-}$trial_url${normal:-}"
1321-
echo "$trial_url"
1322-
return 0
1323-
else
1324-
say_verbose "No match at ${yellow:-}$trial_url${normal:-}"
1325-
fi
1326-
done
1327-
return 1
1328-
}
1329-
13301281
get_download_link_from_aka_ms() {
13311282
eval $invocation
13321283

@@ -1379,11 +1330,6 @@ get_download_link_from_aka_ms() {
13791330
return 1
13801331
fi
13811332

1382-
sanitized_redirect_url=$(sanitize_redirect_url "$aka_ms_download_link")
1383-
if [[ -n "$sanitized_redirect_url" ]]; then
1384-
aka_ms_download_link="$sanitized_redirect_url"
1385-
fi
1386-
13871333
say_verbose "The redirect location retrieved: '$aka_ms_download_link'."
13881334
return 0
13891335
else
@@ -1396,24 +1342,15 @@ get_feeds_to_use()
13961342
{
13971343
feeds=(
13981344
"https://builds.dotnet.microsoft.com/dotnet"
1399-
"https://dotnetcli.azureedge.net/dotnet"
14001345
"https://ci.dot.net/public"
1401-
"https://dotnetbuilds.azureedge.net/public"
14021346
)
14031347

14041348
if [[ -n "$azure_feed" ]]; then
14051349
feeds=("$azure_feed")
14061350
fi
14071351

1408-
if [[ "$no_cdn" == "true" ]]; then
1409-
feeds=(
1410-
"https://dotnetcli.blob.core.windows.net/dotnet"
1411-
"https://dotnetbuilds.blob.core.windows.net/public"
1412-
)
1413-
1414-
if [[ -n "$uncached_feed" ]]; then
1415-
feeds=("$uncached_feed")
1416-
fi
1352+
if [[ -n "$uncached_feed" ]]; then
1353+
feeds=("$uncached_feed")
14171354
fi
14181355
}
14191356

@@ -1545,7 +1482,7 @@ generate_regular_links() {
15451482
link_types+=("legacy")
15461483
else
15471484
legacy_download_link=""
1548-
say_verbose "Cound not construct a legacy_download_link; omitting..."
1485+
say_verbose "Could not construct a legacy_download_link; omitting..."
15491486
fi
15501487

15511488
# Check if the SDK version is already installed.
@@ -1648,7 +1585,7 @@ install_dotnet() {
16481585
say "The resource at $link_type link '$download_link' is not available."
16491586
;;
16501587
*)
1651-
say "Failed to download $link_type link '$download_link': $download_error_msg"
1588+
say "Failed to download $link_type link '$download_link': $http_code $download_error_msg"
16521589
;;
16531590
esac
16541591
rm -f "$zip_path" 2>&1 && say_verbose "Temporary archive file $zip_path was removed"
@@ -1709,7 +1646,6 @@ install_dir="<auto>"
17091646
architecture="<auto>"
17101647
dry_run=false
17111648
no_path=false
1712-
no_cdn=false
17131649
azure_feed=""
17141650
uncached_feed=""
17151651
feed_credential=""
@@ -1782,10 +1718,6 @@ do
17821718
verbose=true
17831719
non_dynamic_parameters+=" $name"
17841720
;;
1785-
--no-cdn|-[Nn]o[Cc]dn)
1786-
no_cdn=true
1787-
non_dynamic_parameters+=" $name"
1788-
;;
17891721
--azure-feed|-[Aa]zure[Ff]eed)
17901722
shift
17911723
azure_feed="$1"
@@ -1862,7 +1794,7 @@ do
18621794
echo " examples: 2.0.0-preview2-006120; 1.1.0"
18631795
echo " -q,--quality <quality> Download the latest build of specified quality in the channel."
18641796
echo " -Quality"
1865-
echo " The possible values are: daily, signed, validated, preview, GA."
1797+
echo " The possible values are: daily, preview, GA."
18661798
echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used."
18671799
echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported."
18681800
echo " Supported since 5.0 release."
@@ -1890,13 +1822,10 @@ do
18901822
echo " --verbose,-Verbose Display diagnostics information."
18911823
echo " --azure-feed,-AzureFeed For internal use only."
18921824
echo " Allows using a different storage to download SDK archives from."
1893-
echo " This parameter is only used if --no-cdn is false."
18941825
echo " --uncached-feed,-UncachedFeed For internal use only."
18951826
echo " Allows using a different storage to download SDK archives from."
1896-
echo " This parameter is only used if --no-cdn is true."
18971827
echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable."
18981828
echo " -SkipNonVersionedFiles"
1899-
echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly."
19001829
echo " --jsonfile <JSONFILE> Determines the SDK version from a user specified global.json file."
19011830
echo " Note: global.json must have a value for 'SDK:Version'"
19021831
echo " --keep-zip,-KeepZip If set, downloaded file is kept."
@@ -1956,4 +1885,4 @@ fi
19561885

19571886
say "Note that the script does not resolve dependencies during installation."
19581887
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."
1959-
say "Installation finished successfully."
1888+
say "Installation finished successfully."

0 commit comments

Comments
 (0)