Default channel=LTS

Clarify nomenclature from "alternate" to "legacy"
Skip construction of legacy URL if it's flawed.
This commit is contained in:
John Beisner 2017-06-09 12:00:29 -07:00
parent 07b93e9d7c
commit cd753db228
2 changed files with 31 additions and 23 deletions

View file

@ -10,7 +10,7 @@
Installs dotnet cli. If dotnet installation already exists in the given directory 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. it will update it only if the requested version differs from the one already installed.
.PARAMETER Channel .PARAMETER Channel
Default: release/1.0.0 Default: LTS
Download from the Channel specified Download from the Channel specified
.PARAMETER Version .PARAMETER Version
Default: latest Default: latest
@ -55,7 +55,7 @@
#> #>
[cmdletbinding()] [cmdletbinding()]
param( param(
[string]$Channel="release/1.0.0", [string]$Channel="LTS",
[string]$Version="Latest", [string]$Version="Latest",
[string]$InstallDir="<auto>", [string]$InstallDir="<auto>",
[string]$Architecture="<auto>", [string]$Architecture="<auto>",
@ -261,7 +261,7 @@ function Get-Download-Link([string]$AzureFeed, [string]$Channel, [string]$Specif
return $PayloadURL 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 Say-Invocation $MyInvocation
if ($SharedRuntime) { 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" $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 return $PayloadURL
} }
@ -432,12 +432,12 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture $CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version $SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version
$DownloadLink = Get-Download-Link -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture $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) { if ($DryRun) {
Say "Payload URLs:" Say "Payload URLs:"
Say "Primary - $DownloadLink" Say "Primary - $DownloadLink"
Say "Alternate - $AltDownloadLink" Say "Legacy - $LegacyDownloadLink"
Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir" Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir"
exit 0 exit 0
} }
@ -469,7 +469,7 @@ try {
DownloadFile -Uri $DownloadLink -OutPath $ZipPath DownloadFile -Uri $DownloadLink -OutPath $ZipPath
} }
catch { catch {
$DownloadLink = $AltDownloadLink $DownloadLink = $LegacyDownloadLink
$ZipPath = [System.IO.Path]::GetTempFileName() $ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink" Say "Downloading $DownloadLink"
DownloadFile -Uri $DownloadLink -OutPath $ZipPath DownloadFile -Uri $DownloadLink -OutPath $ZipPath

View file

@ -147,7 +147,7 @@ get_distro_specific_os_name() {
fi fi
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 return 1
} }
@ -412,7 +412,7 @@ construct_download_link() {
# channel - $2 # channel - $2
# normalized_architecture - $3 # normalized_architecture - $3
# specific_version - $4 # specific_version - $4
construct_alt_download_link() { construct_legacy_download_link() {
eval $invocation eval $invocation
local azure_feed=$1 local azure_feed=$1
@ -423,14 +423,14 @@ construct_alt_download_link() {
local distro_specific_osname local distro_specific_osname
distro_specific_osname=$(get_distro_specific_os_name) || return 1 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 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 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 fi
echo "$alt_download_link" echo "$legacy_download_link"
return 0 return 0
} }
@ -601,7 +601,8 @@ downloadwget() {
calculate_vars() { calculate_vars() {
eval $invocation eval $invocation
valid_legacy_download_link=false
normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture") normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture")
say_verbose "normalized_architecture=$normalized_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) download_link=$(construct_download_link $azure_feed $channel $normalized_architecture $specific_version)
say_verbose "download_link=$download_link" say_verbose "download_link=$download_link"
alt_download_link=$(construct_alt_download_link $azure_feed $channel $normalized_architecture $specific_version) if [ legacy_download_link=$(construct_legacy_download_link $azure_feed $channel $normalized_architecture $specific_version) ]; then
say_verbose "alt_download_link=$alt_download_link" 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) install_root=$(resolve_installation_path $install_dir)
say_verbose "install_root=$install_root" say_verbose "install_root=$install_root"
@ -638,13 +643,13 @@ install_dotnet() {
say "Downloading link: $download_link" say "Downloading link: $download_link"
download "$download_link" $zip_path || download_failed=true download "$download_link" $zip_path || download_failed=true
# if the download fails, download the alt_download_link # if the download fails, download the legacy_download_link
if [ "$download_failed" = true ]; then if [ "$download_failed" = true && "$valid_legacy_download_link" = true ]; then
say "Cannot download: $download_link" say "Cannot download: $download_link"
zip_path=$(mktemp $temporary_file_template) zip_path=$(mktemp $temporary_file_template)
say_verbose "Alternate zip path: $zip_path" say_verbose "Legacy zip path: $zip_path"
say "Downloading alternate link: $alt_download_link" say "Downloading legacy link: $legacy_download_link"
download "$alt_download_link" $zip_path download "$legacy_download_link" $zip_path
fi fi
say "Extracting zip" say "Extracting zip"
@ -657,7 +662,7 @@ local_version_file_relative_path="/.version"
bin_folder_relative_path="" bin_folder_relative_path=""
temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX"
channel="release/1.0.0" channel="LTS"
version="Latest" version="Latest"
install_dir="<auto>" install_dir="<auto>"
architecture="<auto>" architecture="<auto>"
@ -764,9 +769,12 @@ done
check_min_reqs check_min_reqs
calculate_vars calculate_vars
if [ "$dry_run" = true ]; then if [ "$dry_run" = true ]; then
say "Payload URL: $download_link" 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" say "Repeatable invocation: ./$(basename $0) --version $specific_version --channel $channel --install-dir $install_dir"
exit 0 exit 0
fi fi