diff --git a/scripts/obtain/dotnet-install.ps1 b/scripts/obtain/dotnet-install.ps1 index 5bfd355eb..14ebe11af 100644 --- a/scripts/obtain/dotnet-install.ps1 +++ b/scripts/obtain/dotnet-install.ps1 @@ -73,6 +73,8 @@ .PARAMETER SkipNonVersionedFiles Default: false Skips installing non-versioned files if they already exist, such as dotnet.exe. +.PARAMETER NoCdn + Disable downloading from the Azure CDN, and use the uncached feed directly. #> [cmdletbinding()] param( @@ -91,13 +93,18 @@ param( [string]$FeedCredential, [string]$ProxyAddress, [switch]$ProxyUseDefaultCredentials, - [switch]$SkipNonVersionedFiles + [switch]$SkipNonVersionedFiles, + [switch]$NoCdn ) Set-StrictMode -Version Latest $ErrorActionPreference="Stop" $ProgressPreference="SilentlyContinue" +if ($NoCdn) { + $AzureFeed = $UncachedFeed +} + $BinFolderRelativePath="" if ($SharedRuntime -and (-not $Runtime)) { @@ -461,6 +468,12 @@ function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { } function DownloadFile([Uri]$Uri, [string]$OutPath) { + if ($Uri -notlike "http*") { + Say-Verbose "Copying file from $Uri to $OutPath" + Copy-Item $Uri.AbsolutePath $OutPath + return + } + $Stream = $null try { diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index cee78b1ae..6dda76038 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -648,6 +648,11 @@ download() { local remote_path="$1" local out_path="${2:-}" + if [[ "$remote_path" != "http"* ]]; then + cp "$remote_path" "$out_path" + return $? + fi + local failed=false if machine_has "curl"; then downloadcurl "$remote_path" "$out_path" || failed=true @@ -811,6 +816,7 @@ install_dir="" architecture="" dry_run=false no_path=false +no_cdn=false azure_feed="https://dotnetcli.azureedge.net/dotnet" uncached_feed="https://dotnetcli.blob.core.windows.net/dotnet" feed_credential="" @@ -862,6 +868,9 @@ do --verbose|-[Vv]erbose) verbose=true ;; + --no-cdn|-[Nn]o[Cc]dn) + no_cdn=true + ;; --azure-feed|-[Aa]zure[Ff]eed) shift azure_feed="$1" @@ -924,6 +933,7 @@ do echo " --verbose,-Verbose Display diagnostics information." echo " --azure-feed,-AzureFeed Azure feed location. Defaults to $azure_feed, This parameter typically is not changed by the user." echo " --uncached-feed,-UncachedFeed Uncached feed location. This parameter typically is not changed by the user." + echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly." echo " --feed-credential,-FeedCredential Azure feed shared access token. This parameter typically is not specified." echo " --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)." echo " -RuntimeId" @@ -949,6 +959,10 @@ do shift done +if [ "$no_cdn" = true ]; then + azure_feed="$uncached_feed" +fi + check_min_reqs calculate_vars