Add flag to skip download from the CDN, and support installing from a local file share

This commit is contained in:
Nate McMaster 2018-06-08 16:41:54 -07:00
parent 5e1c9e5559
commit 91e2612ea1
No known key found for this signature in database
GPG key ID: A778D9601BD78810
2 changed files with 28 additions and 1 deletions

View file

@ -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 {

View file

@ -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="<auto>"
architecture="<auto>"
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