Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit cd753db

Browse files
author
John Beisner
committed
Default channel=LTS
Clarify nomenclature from "alternate" to "legacy" Skip construction of legacy URL if it's flawed.
1 parent 07b93e9 commit cd753db

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

scripts/obtain/dotnet-install.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Installs dotnet cli. If dotnet installation already exists in the given directory
1111
it will update it only if the requested version differs from the one already installed.
1212
.PARAMETER Channel
13-
Default: release/1.0.0
13+
Default: LTS
1414
Download from the Channel specified
1515
.PARAMETER Version
1616
Default: latest
@@ -55,7 +55,7 @@
5555
#>
5656
[cmdletbinding()]
5757
param(
58-
[string]$Channel="release/1.0.0",
58+
[string]$Channel="LTS",
5959
[string]$Version="Latest",
6060
[string]$InstallDir="<auto>",
6161
[string]$Architecture="<auto>",
@@ -261,7 +261,7 @@ function Get-Download-Link([string]$AzureFeed, [string]$Channel, [string]$Specif
261261
return $PayloadURL
262262
}
263263

264-
function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
264+
function Get-LegacytDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
265265
Say-Invocation $MyInvocation
266266

267267
if ($SharedRuntime) {
@@ -271,7 +271,7 @@ function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$Spe
271271
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
272272
}
273273

274-
Say-Verbose "Constructed alternate payload URL: $PayloadURL"
274+
Say-Verbose "Constructed legacy payload URL: $PayloadURL"
275275

276276
return $PayloadURL
277277
}
@@ -432,12 +432,12 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
432432
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
433433
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version
434434
$DownloadLink = Get-Download-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
435-
$AltDownloadLink = Get-AltDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
435+
$LegacyDownloadLink = Get-LegacyDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
436436

437437
if ($DryRun) {
438438
Say "Payload URLs:"
439439
Say "Primary - $DownloadLink"
440-
Say "Alternate - $AltDownloadLink"
440+
Say "Legacy - $LegacyDownloadLink"
441441
Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir"
442442
exit 0
443443
}
@@ -469,7 +469,7 @@ try {
469469
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
470470
}
471471
catch {
472-
$DownloadLink = $AltDownloadLink
472+
$DownloadLink = $LegacyDownloadLink
473473
$ZipPath = [System.IO.Path]::GetTempFileName()
474474
Say "Downloading $DownloadLink"
475475
DownloadFile -Uri $DownloadLink -OutPath $ZipPath

scripts/obtain/dotnet-install.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ get_distro_specific_os_name() {
147147
fi
148148
fi
149149

150-
say_err "OS name could not be detected: $ID.$VERSION_ID"
150+
say_verbose "Distribution specific OS name + version could not be detected: $ID.$VERSION_ID"
151151
return 1
152152
}
153153

@@ -412,7 +412,7 @@ construct_download_link() {
412412
# channel - $2
413413
# normalized_architecture - $3
414414
# specific_version - $4
415-
construct_alt_download_link() {
415+
construct_legacy_download_link() {
416416
eval $invocation
417417

418418
local azure_feed=$1
@@ -423,14 +423,14 @@ construct_alt_download_link() {
423423
local distro_specific_osname
424424
distro_specific_osname=$(get_distro_specific_os_name) || return 1
425425

426-
local alt_download_link=null
426+
local legacy_download_link=null
427427
if [ "$shared_runtime" = true ]; then
428-
alt_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
428+
legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
429429
else
430-
alt_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
430+
legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
431431
fi
432432

433-
echo "$alt_download_link"
433+
echo "$legacy_download_link"
434434
return 0
435435
}
436436

@@ -601,7 +601,8 @@ downloadwget() {
601601

602602
calculate_vars() {
603603
eval $invocation
604-
604+
valid_legacy_download_link=false
605+
605606
normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture")
606607
say_verbose "normalized_architecture=$normalized_architecture"
607608

@@ -615,8 +616,12 @@ calculate_vars() {
615616
download_link=$(construct_download_link $azure_feed $channel $normalized_architecture $specific_version)
616617
say_verbose "download_link=$download_link"
617618

618-
alt_download_link=$(construct_alt_download_link $azure_feed $channel $normalized_architecture $specific_version)
619-
say_verbose "alt_download_link=$alt_download_link"
619+
if [ legacy_download_link=$(construct_legacy_download_link $azure_feed $channel $normalized_architecture $specific_version) ]; then
620+
say_verbose "legacy_download_link=$legacy_download_link"
621+
valid_legacy_download_link=true
622+
else
623+
say_verbose "Cound not construct a legacy_download_link; omitting..."
624+
fi
620625

621626
install_root=$(resolve_installation_path $install_dir)
622627
say_verbose "install_root=$install_root"
@@ -638,13 +643,13 @@ install_dotnet() {
638643
say "Downloading link: $download_link"
639644
download "$download_link" $zip_path || download_failed=true
640645

641-
# if the download fails, download the alt_download_link
642-
if [ "$download_failed" = true ]; then
646+
# if the download fails, download the legacy_download_link
647+
if [ "$download_failed" = true && "$valid_legacy_download_link" = true ]; then
643648
say "Cannot download: $download_link"
644649
zip_path=$(mktemp $temporary_file_template)
645-
say_verbose "Alternate zip path: $zip_path"
646-
say "Downloading alternate link: $alt_download_link"
647-
download "$alt_download_link" $zip_path
650+
say_verbose "Legacy zip path: $zip_path"
651+
say "Downloading legacy link: $legacy_download_link"
652+
download "$legacy_download_link" $zip_path
648653
fi
649654

650655
say "Extracting zip"
@@ -657,7 +662,7 @@ local_version_file_relative_path="/.version"
657662
bin_folder_relative_path=""
658663
temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX"
659664

660-
channel="release/1.0.0"
665+
channel="LTS"
661666
version="Latest"
662667
install_dir="<auto>"
663668
architecture="<auto>"
@@ -764,9 +769,12 @@ done
764769

765770
check_min_reqs
766771
calculate_vars
772+
767773
if [ "$dry_run" = true ]; then
768774
say "Payload URL: $download_link"
769-
say "Alternate payload URL: $alt_download_link"
775+
if [ "$valid_legacy_download_link" = true ]; then
776+
say "Legacy payload URL: $legacy_download_link"
777+
fi
770778
say "Repeatable invocation: ./$(basename $0) --version $specific_version --channel $channel --install-dir $install_dir"
771779
exit 0
772780
fi

0 commit comments

Comments
 (0)