First draft changes for install script for the SDK and Runtime.
This commit is contained in:
parent
3037fdd688
commit
3db157aba6
2 changed files with 146 additions and 91 deletions
57
scripts/obtain/dotnet-install.ps1
vendored
57
scripts/obtain/dotnet-install.ps1
vendored
|
@ -10,18 +10,14 @@
|
|||
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: preview
|
||||
Channel is the way of reasoning about stability and quality of dotnet. This parameter takes one of the values:
|
||||
- future - Possibly unstable, frequently changing, may contain new finished and unfinished features
|
||||
- preview - Pre-release stable with known issues and feature gaps
|
||||
- production - Most stable releases
|
||||
Default: master
|
||||
Download from the Channel specified
|
||||
.PARAMETER Version
|
||||
Default: latest
|
||||
Represents a build version on specific channel. Possible values:
|
||||
- 4-part version in a format A.B.C.D - represents specific version of build
|
||||
- latest - most latest build on specific channel
|
||||
- lkg - last known good version on specific channel
|
||||
Note: LKG work is in progress. Once the work is finished, this will become new default
|
||||
- 3-part version in a format A.B.C - represents specific version of build
|
||||
examples: 2.0.0-preview2-006120; 1.1.0
|
||||
.PARAMETER InstallDir
|
||||
Default: %LocalAppData%\Microsoft\dotnet
|
||||
Path to where to install dotnet. Note that binaries will be placed directly in a given directory.
|
||||
|
@ -46,7 +42,11 @@
|
|||
Displays diagnostics information.
|
||||
.PARAMETER AzureFeed
|
||||
Default: https://dotnetcli.azureedge.net/dotnet
|
||||
This parameter should not be usually changed by user. It allows to change URL for the Azure feed used by this installer.
|
||||
This parameter typically is not changed by the user.
|
||||
It allows to change URL for the Azure feed used by this installer.
|
||||
.PARAMETER UncachedFeed
|
||||
This parameter typically is not changed by the user.
|
||||
It allows to change URL for the Uncached feed used by this installer.
|
||||
.PARAMETER ProxyAddress
|
||||
If set, the installer will use the proxy when making web requests
|
||||
.PARAMETER ProxyUseDefaultCredentials
|
||||
|
@ -55,7 +55,7 @@
|
|||
#>
|
||||
[cmdletbinding()]
|
||||
param(
|
||||
[string]$Channel="rel-1.0.0",
|
||||
[string]$Channel="master",
|
||||
[string]$Version="Latest",
|
||||
[string]$InstallDir="<auto>",
|
||||
[string]$Architecture="<auto>",
|
||||
|
@ -149,8 +149,8 @@ function GetHTTPResponse([Uri] $Uri)
|
|||
$HttpClient = New-Object System.Net.Http.HttpClient
|
||||
}
|
||||
# Default timeout for HttpClient is 100s. For a 50 MB download this assumes 500 KB/s average, any less will time out
|
||||
# 5 minutes allows it to work over much slower connections.
|
||||
$HttpClient.Timeout = New-TimeSpan -Minutes 5
|
||||
# 10 minutes allows it to work over much slower connections.
|
||||
$HttpClient.Timeout = New-TimeSpan -Minutes 10
|
||||
$Response = $HttpClient.GetAsync($Uri).Result
|
||||
if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode)))
|
||||
{
|
||||
|
@ -173,15 +173,15 @@ function GetHTTPResponse([Uri] $Uri)
|
|||
}
|
||||
|
||||
|
||||
function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) {
|
||||
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [string]$CLIArchitecture) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
$VersionFileUrl = $null
|
||||
if ($SharedRuntime) {
|
||||
$VersionFileUrl = "$UncachedFeed/$AzureChannel/dnvm/latest.sharedfx.win.$CLIArchitecture.version"
|
||||
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
|
||||
}
|
||||
else {
|
||||
$VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version"
|
||||
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
|
||||
}
|
||||
|
||||
$Response = GetHTTPResponse -Uri $VersionFileUrl
|
||||
|
@ -189,7 +189,7 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str
|
|||
|
||||
switch ($Response.Content.Headers.ContentType) {
|
||||
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
|
||||
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
|
||||
{ ($_ -eq "text/plain") } { ($_ -eq "text/plain; charset=UTF-8") } { $VersionText = $StringContent }
|
||||
default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." }
|
||||
}
|
||||
|
||||
|
@ -198,38 +198,26 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str
|
|||
return $VersionInfo
|
||||
}
|
||||
|
||||
# TODO: AzureChannel and Channel should be unified
|
||||
function Get-Azure-Channel-From-Channel([string]$Channel) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
# For compatibility with build scripts accept also directly Azure channels names
|
||||
switch ($Channel.ToLower()) {
|
||||
{ ($_ -eq "future") -or ($_ -eq "dev") } { return "dev" }
|
||||
{ $_ -eq "production" } { throw "Production channel does not exist yet" }
|
||||
default { return $_ }
|
||||
}
|
||||
}
|
||||
|
||||
function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture, [string]$Version) {
|
||||
function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel, [string]$CLIArchitecture, [string]$Version) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
switch ($Version.ToLower()) {
|
||||
{ $_ -eq "latest" } {
|
||||
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture
|
||||
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -CLIArchitecture $CLIArchitecture
|
||||
return $LatestVersionInfo.Version
|
||||
}
|
||||
{ $_ -eq "lkg" } { throw "``-Version LKG`` not supported yet." }
|
||||
default { return $Version }
|
||||
}
|
||||
}
|
||||
|
||||
function Get-Download-Links([string]$AzureFeed, [string]$AzureChannel, [string]$SpecificVersion, [string]$CLIArchitecture) {
|
||||
function Get-Download-Links([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
|
||||
Say-Invocation $MyInvocation
|
||||
|
||||
$ret = @()
|
||||
|
||||
if ($SharedRuntime) {
|
||||
$PayloadURL = "$AzureFeed/$AzureChannel/Binaries/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip"
|
||||
$PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-sharedframework-win-$CLIArchitecture.$SpecificVersion.zip"
|
||||
}
|
||||
else {
|
||||
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
|
||||
|
@ -394,10 +382,9 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
|
|||
}
|
||||
}
|
||||
|
||||
$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel
|
||||
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
|
||||
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version
|
||||
$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -AzureChannel $AzureChannel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
|
||||
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -CLIArchitecture $CLIArchitecture -Version $Version
|
||||
$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
|
||||
|
||||
if ($DryRun) {
|
||||
Say "Payload URLs:"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue