Default channel=LTS
Clarify nomenclature from "alternate" to "legacy" Skip construction of legacy URL if it's flawed.
This commit is contained in:
parent
07b93e9d7c
commit
cd753db228
2 changed files with 31 additions and 23 deletions
14
scripts/obtain/dotnet-install.ps1
vendored
14
scripts/obtain/dotnet-install.ps1
vendored
|
@ -10,7 +10,7 @@
|
|||
Installs dotnet cli. If dotnet installation already exists in the given directory
|
||||
it will update it only if the requested version differs from the one already installed.
|
||||
.PARAMETER Channel
|
||||
Default: release/1.0.0
|
||||
Default: LTS
|
||||
Download from the Channel specified
|
||||
.PARAMETER Version
|
||||
Default: latest
|
||||
|
@ -55,7 +55,7 @@
|
|||
#>
|
||||
[cmdletbinding()]
|
||||
param(
|
||||
[string]$Channel="release/1.0.0",
|
||||
[string]$Channel="LTS",
|
||||
[string]$Version="Latest",
|
||||
[string]$InstallDir="<auto>",
|
||||
[string]$Architecture="<auto>",
|
||||
|
@ -261,7 +261,7 @@ function Get-Download-Link([string]$AzureFeed, [string]$Channel, [string]$Specif
|
|||
return $PayloadURL
|
||||
}
|
||||
|
||||
function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
|
||||
function Get-LegacytDownload-Link([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
if ($SharedRuntime) {
|
||||
|
@ -271,7 +271,7 @@ function Get-AltDownload-Link([string]$AzureFeed, [string]$Channel, [string]$Spe
|
|||
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
|
||||
}
|
||||
|
||||
Say-Verbose "Constructed alternate payload URL: $PayloadURL"
|
||||
Say-Verbose "Constructed legacy payload URL: $PayloadURL"
|
||||
|
||||
return $PayloadURL
|
||||
}
|
||||
|
@ -432,12 +432,12 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
|
|||
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
|
||||
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version
|
||||
$DownloadLink = Get-Download-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
|
||||
$AltDownloadLink = Get-AltDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
|
||||
$LegacyDownloadLink = Get-LegacyDownload-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
|
||||
|
||||
if ($DryRun) {
|
||||
Say "Payload URLs:"
|
||||
Say "Primary - $DownloadLink"
|
||||
Say "Alternate - $AltDownloadLink"
|
||||
Say "Legacy - $LegacyDownloadLink"
|
||||
Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir"
|
||||
exit 0
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ try {
|
|||
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
|
||||
}
|
||||
catch {
|
||||
$DownloadLink = $AltDownloadLink
|
||||
$DownloadLink = $LegacyDownloadLink
|
||||
$ZipPath = [System.IO.Path]::GetTempFileName()
|
||||
Say "Downloading $DownloadLink"
|
||||
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
|
||||
|
|
40
scripts/obtain/dotnet-install.sh
vendored
40
scripts/obtain/dotnet-install.sh
vendored
|
@ -147,7 +147,7 @@ get_distro_specific_os_name() {
|
|||
fi
|
||||
fi
|
||||
|
||||
say_err "OS name could not be detected: $ID.$VERSION_ID"
|
||||
say_verbose "Distribution specific OS name + version could not be detected: $ID.$VERSION_ID"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ construct_download_link() {
|
|||
# channel - $2
|
||||
# normalized_architecture - $3
|
||||
# specific_version - $4
|
||||
construct_alt_download_link() {
|
||||
construct_legacy_download_link() {
|
||||
eval $invocation
|
||||
|
||||
local azure_feed=$1
|
||||
|
@ -423,14 +423,14 @@ construct_alt_download_link() {
|
|||
local distro_specific_osname
|
||||
distro_specific_osname=$(get_distro_specific_os_name) || return 1
|
||||
|
||||
local alt_download_link=null
|
||||
local legacy_download_link=null
|
||||
if [ "$shared_runtime" = true ]; then
|
||||
alt_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
|
||||
legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
|
||||
else
|
||||
alt_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
|
||||
legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz"
|
||||
fi
|
||||
|
||||
echo "$alt_download_link"
|
||||
echo "$legacy_download_link"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,8 @@ downloadwget() {
|
|||
|
||||
calculate_vars() {
|
||||
eval $invocation
|
||||
|
||||
valid_legacy_download_link=false
|
||||
|
||||
normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture")
|
||||
say_verbose "normalized_architecture=$normalized_architecture"
|
||||
|
||||
|
@ -615,8 +616,12 @@ calculate_vars() {
|
|||
download_link=$(construct_download_link $azure_feed $channel $normalized_architecture $specific_version)
|
||||
say_verbose "download_link=$download_link"
|
||||
|
||||
alt_download_link=$(construct_alt_download_link $azure_feed $channel $normalized_architecture $specific_version)
|
||||
say_verbose "alt_download_link=$alt_download_link"
|
||||
if [ legacy_download_link=$(construct_legacy_download_link $azure_feed $channel $normalized_architecture $specific_version) ]; then
|
||||
say_verbose "legacy_download_link=$legacy_download_link"
|
||||
valid_legacy_download_link=true
|
||||
else
|
||||
say_verbose "Cound not construct a legacy_download_link; omitting..."
|
||||
fi
|
||||
|
||||
install_root=$(resolve_installation_path $install_dir)
|
||||
say_verbose "install_root=$install_root"
|
||||
|
@ -638,13 +643,13 @@ install_dotnet() {
|
|||
say "Downloading link: $download_link"
|
||||
download "$download_link" $zip_path || download_failed=true
|
||||
|
||||
# if the download fails, download the alt_download_link
|
||||
if [ "$download_failed" = true ]; then
|
||||
# if the download fails, download the legacy_download_link
|
||||
if [ "$download_failed" = true && "$valid_legacy_download_link" = true ]; then
|
||||
say "Cannot download: $download_link"
|
||||
zip_path=$(mktemp $temporary_file_template)
|
||||
say_verbose "Alternate zip path: $zip_path"
|
||||
say "Downloading alternate link: $alt_download_link"
|
||||
download "$alt_download_link" $zip_path
|
||||
say_verbose "Legacy zip path: $zip_path"
|
||||
say "Downloading legacy link: $legacy_download_link"
|
||||
download "$legacy_download_link" $zip_path
|
||||
fi
|
||||
|
||||
say "Extracting zip"
|
||||
|
@ -657,7 +662,7 @@ local_version_file_relative_path="/.version"
|
|||
bin_folder_relative_path=""
|
||||
temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX"
|
||||
|
||||
channel="release/1.0.0"
|
||||
channel="LTS"
|
||||
version="Latest"
|
||||
install_dir="<auto>"
|
||||
architecture="<auto>"
|
||||
|
@ -764,9 +769,12 @@ done
|
|||
|
||||
check_min_reqs
|
||||
calculate_vars
|
||||
|
||||
if [ "$dry_run" = true ]; then
|
||||
say "Payload URL: $download_link"
|
||||
say "Alternate payload URL: $alt_download_link"
|
||||
if [ "$valid_legacy_download_link" = true ]; then
|
||||
say "Legacy payload URL: $legacy_download_link"
|
||||
fi
|
||||
say "Repeatable invocation: ./$(basename $0) --version $specific_version --channel $channel --install-dir $install_dir"
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue