Add -SkipNonVersionedFiles to dotnet-install.{sh,ps1}

This commit is contained in:
Nate McMaster 2017-08-24 14:06:38 -07:00
parent 4662629964
commit 7586ad844d
2 changed files with 14 additions and 3 deletions

View file

@ -58,6 +58,9 @@
.PARAMETER ProxyUseDefaultCredentials .PARAMETER ProxyUseDefaultCredentials
Default: false Default: false
Use default credentials, when using proxy address. Use default credentials, when using proxy address.
.PARAMETER SkipNonVersionedFiles
Default: false
Skips installing non-versioned files if they already exist, such as dotnet.exe.
#> #>
[cmdletbinding()] [cmdletbinding()]
param( param(
@ -71,7 +74,8 @@ param(
[string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet", [string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet",
[string]$UncachedFeed="https://dotnetcli.blob.core.windows.net/dotnet", [string]$UncachedFeed="https://dotnetcli.blob.core.windows.net/dotnet",
[string]$ProxyAddress, [string]$ProxyAddress,
[switch]$ProxyUseDefaultCredentials [switch]$ProxyUseDefaultCredentials,
[switch]$SkipNonVersionedFiles
) )
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
@ -82,7 +86,7 @@ $BinFolderRelativePath=""
# example path with regex: shared/1.0.0-beta-12345/somepath # example path with regex: shared/1.0.0-beta-12345/somepath
$VersionRegEx="/\d+\.\d+[^/]+/" $VersionRegEx="/\d+\.\d+[^/]+/"
$OverrideNonVersionedFiles=$true $OverrideNonVersionedFiles = !$SkipNonVersionedFiles
function Say($str) { function Say($str) {
Write-Output "dotnet-install: $str" Write-Output "dotnet-install: $str"

View file

@ -541,7 +541,7 @@ extract_dotnet_package() {
local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/'
find $temp_out_path -type f | grep -Eo $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path false find $temp_out_path -type f | grep -Eo $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path false
find $temp_out_path -type f | grep -Ev $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path true find $temp_out_path -type f | grep -Ev $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path $override_non_versioned_files
rm -rf $temp_out_path rm -rf $temp_out_path
@ -687,6 +687,7 @@ uncached_feed="https://dotnetcli.blob.core.windows.net/dotnet"
verbose=false verbose=false
shared_runtime=false shared_runtime=false
runtime_id="" runtime_id=""
override_non_versioned_files=true
while [ $# -ne 0 ] while [ $# -ne 0 ]
do do
@ -732,6 +733,10 @@ do
shift shift
runtime_id="$1" runtime_id="$1"
;; ;;
--skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles)
shift
override_non_versioned_files=false
;;
-?|--?|-h|--help|-[Hh]elp) -?|--?|-h|--help|-[Hh]elp)
script_name="$(basename $0)" script_name="$(basename $0)"
echo ".NET Tools Installer" echo ".NET Tools Installer"
@ -764,6 +769,8 @@ do
echo " --arch,-Architecture,-Arch" echo " --arch,-Architecture,-Arch"
echo " --shared-runtime Installs just the shared runtime bits, not the entire SDK." echo " --shared-runtime Installs just the shared runtime bits, not the entire SDK."
echo " -SharedRuntime" echo " -SharedRuntime"
echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable."
echo " -SkipNonVersionedFiles"
echo " --dry-run,-DryRun Do not perform installation. Display download link." echo " --dry-run,-DryRun Do not perform installation. Display download link."
echo " --no-path, -NoPath Do not set PATH for the current process." echo " --no-path, -NoPath Do not set PATH for the current process."
echo " --verbose,-Verbose Display diagnostics information." echo " --verbose,-Verbose Display diagnostics information."