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

Commit 3db157a

Browse files
author
John Beisner
committed
First draft changes for install script for the SDK and Runtime.
1 parent 3037fdd commit 3db157a

File tree

2 files changed

+146
-91
lines changed

2 files changed

+146
-91
lines changed

scripts/obtain/dotnet-install.ps1

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@
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: preview
14-
Channel is the way of reasoning about stability and quality of dotnet. This parameter takes one of the values:
15-
- future - Possibly unstable, frequently changing, may contain new finished and unfinished features
16-
- preview - Pre-release stable with known issues and feature gaps
17-
- production - Most stable releases
13+
Default: master
14+
Download from the Channel specified
1815
.PARAMETER Version
1916
Default: latest
2017
Represents a build version on specific channel. Possible values:
21-
- 4-part version in a format A.B.C.D - represents specific version of build
2218
- latest - most latest build on specific channel
23-
- lkg - last known good version on specific channel
24-
Note: LKG work is in progress. Once the work is finished, this will become new default
19+
- 3-part version in a format A.B.C - represents specific version of build
20+
examples: 2.0.0-preview2-006120; 1.1.0
2521
.PARAMETER InstallDir
2622
Default: %LocalAppData%\Microsoft\dotnet
2723
Path to where to install dotnet. Note that binaries will be placed directly in a given directory.
@@ -46,7 +42,11 @@
4642
Displays diagnostics information.
4743
.PARAMETER AzureFeed
4844
Default: https://dotnetcli.azureedge.net/dotnet
49-
This parameter should not be usually changed by user. It allows to change URL for the Azure feed used by this installer.
45+
This parameter typically is not changed by the user.
46+
It allows to change URL for the Azure feed used by this installer.
47+
.PARAMETER UncachedFeed
48+
This parameter typically is not changed by the user.
49+
It allows to change URL for the Uncached feed used by this installer.
5050
.PARAMETER ProxyAddress
5151
If set, the installer will use the proxy when making web requests
5252
.PARAMETER ProxyUseDefaultCredentials
@@ -55,7 +55,7 @@
5555
#>
5656
[cmdletbinding()]
5757
param(
58-
[string]$Channel="rel-1.0.0",
58+
[string]$Channel="master",
5959
[string]$Version="Latest",
6060
[string]$InstallDir="<auto>",
6161
[string]$Architecture="<auto>",
@@ -149,8 +149,8 @@ function GetHTTPResponse([Uri] $Uri)
149149
$HttpClient = New-Object System.Net.Http.HttpClient
150150
}
151151
# Default timeout for HttpClient is 100s. For a 50 MB download this assumes 500 KB/s average, any less will time out
152-
# 5 minutes allows it to work over much slower connections.
153-
$HttpClient.Timeout = New-TimeSpan -Minutes 5
152+
# 10 minutes allows it to work over much slower connections.
153+
$HttpClient.Timeout = New-TimeSpan -Minutes 10
154154
$Response = $HttpClient.GetAsync($Uri).Result
155155
if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode)))
156156
{
@@ -173,23 +173,23 @@ function GetHTTPResponse([Uri] $Uri)
173173
}
174174

175175

176-
function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) {
176+
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [string]$CLIArchitecture) {
177177
Say-Invocation $MyInvocation
178178

179179
$VersionFileUrl = $null
180180
if ($SharedRuntime) {
181-
$VersionFileUrl = "$UncachedFeed/$AzureChannel/dnvm/latest.sharedfx.win.$CLIArchitecture.version"
181+
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
182182
}
183183
else {
184-
$VersionFileUrl = "$UncachedFeed/Sdk/$AzureChannel/latest.version"
184+
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
185185
}
186186

187187
$Response = GetHTTPResponse -Uri $VersionFileUrl
188188
$StringContent = $Response.Content.ReadAsStringAsync().Result
189189

190190
switch ($Response.Content.Headers.ContentType) {
191191
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($StringContent) }
192-
{ ($_ -eq "text/plain") } { $VersionText = $StringContent }
192+
{ ($_ -eq "text/plain") } { ($_ -eq "text/plain; charset=UTF-8") } { $VersionText = $StringContent }
193193
default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." }
194194
}
195195

@@ -198,38 +198,26 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [str
198198
return $VersionInfo
199199
}
200200

201-
# TODO: AzureChannel and Channel should be unified
202-
function Get-Azure-Channel-From-Channel([string]$Channel) {
203-
Say-Invocation $MyInvocation
204-
205-
# For compatibility with build scripts accept also directly Azure channels names
206-
switch ($Channel.ToLower()) {
207-
{ ($_ -eq "future") -or ($_ -eq "dev") } { return "dev" }
208-
{ $_ -eq "production" } { throw "Production channel does not exist yet" }
209-
default { return $_ }
210-
}
211-
}
212201

213-
function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture, [string]$Version) {
202+
function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel, [string]$CLIArchitecture, [string]$Version) {
214203
Say-Invocation $MyInvocation
215204

216205
switch ($Version.ToLower()) {
217206
{ $_ -eq "latest" } {
218-
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture
207+
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -CLIArchitecture $CLIArchitecture
219208
return $LatestVersionInfo.Version
220209
}
221-
{ $_ -eq "lkg" } { throw "``-Version LKG`` not supported yet." }
222210
default { return $Version }
223211
}
224212
}
225213

226-
function Get-Download-Links([string]$AzureFeed, [string]$AzureChannel, [string]$SpecificVersion, [string]$CLIArchitecture) {
214+
function Get-Download-Links([string]$AzureFeed, [string]$Channel, [string]$SpecificVersion, [string]$CLIArchitecture) {
227215
Say-Invocation $MyInvocation
228216

229217
$ret = @()
230218

231219
if ($SharedRuntime) {
232-
$PayloadURL = "$AzureFeed/$AzureChannel/Binaries/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip"
220+
$PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-sharedframework-win-$CLIArchitecture.$SpecificVersion.zip"
233221
}
234222
else {
235223
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
@@ -394,10 +382,9 @@ function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolde
394382
}
395383
}
396384

397-
$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel
398385
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
399-
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version
400-
$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -AzureChannel $AzureChannel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
386+
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -CLIArchitecture $CLIArchitecture -Version $Version
387+
$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -Channel $Channel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
401388

402389
if ($DryRun) {
403390
Say "Payload URLs:"

0 commit comments

Comments
 (0)