Rename files.
This commit is contained in:
parent
d87e51887f
commit
b84aafafdd
|
|
@ -1,6 +1,6 @@
|
||||||
@Echo off
|
@Echo off
|
||||||
|
|
||||||
set DNVM_CMD_PATH_FILE="%USERPROFILE%\\.dnx\\temp-set-envvars.cmd"
|
set DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
|
||||||
|
|
||||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%~dp0dnvm.ps1' %*"
|
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%~dp0dnvm.ps1' %*"
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ function _WriteOut {
|
||||||
|
|
||||||
### Constants
|
### Constants
|
||||||
$ProductVersion="1.0.0"
|
$ProductVersion="1.0.0"
|
||||||
$BuildVersion="beta4-10333"
|
$BuildVersion="beta4-10336"
|
||||||
$Authors="Microsoft Open Technologies, Inc."
|
$Authors="Microsoft Open Technologies, Inc."
|
||||||
|
|
||||||
# If the Version hasn't been replaced...
|
# If the Version hasn't been replaced...
|
||||||
|
|
@ -72,27 +72,27 @@ if($BuildVersion.StartsWith("{{")) {
|
||||||
$FullVersion="$ProductVersion-$BuildVersion"
|
$FullVersion="$ProductVersion-$BuildVersion"
|
||||||
|
|
||||||
Set-Variable -Option Constant "CommandName" ([IO.Path]::GetFileNameWithoutExtension($ScriptPath))
|
Set-Variable -Option Constant "CommandName" ([IO.Path]::GetFileNameWithoutExtension($ScriptPath))
|
||||||
Set-Variable -Option Constant "CommandFriendlyName" "K Runtime Version Manager"
|
Set-Variable -Option Constant "CommandFriendlyName" ".NET Version Manager"
|
||||||
Set-Variable -Option Constant "DefaultUserDirectoryName" ".k"
|
Set-Variable -Option Constant "DefaultUserDirectoryName" ".dnx"
|
||||||
Set-Variable -Option Constant "OldUserDirectoryName" ".kre"
|
Set-Variable -Option Constant "OldUserDirectoryNames" @(".kre", ".k")
|
||||||
Set-Variable -Option Constant "RuntimePackageName" "kre"
|
Set-Variable -Option Constant "RuntimePackageName" "dnx"
|
||||||
Set-Variable -Option Constant "DefaultFeed" "https://www.myget.org/F/aspnetvnext/api/v2"
|
Set-Variable -Option Constant "DefaultFeed" "https://www.myget.org/F/aspnetvnext/api/v2"
|
||||||
Set-Variable -Option Constant "CrossGenCommand" "k-crossgen"
|
Set-Variable -Option Constant "CrossGenCommand" "k-crossgen"
|
||||||
Set-Variable -Option Constant "CommandPrefix" "kvm-"
|
Set-Variable -Option Constant "CommandPrefix" "dnvm-"
|
||||||
Set-Variable -Option Constant "DefaultArchitecture" "x86"
|
Set-Variable -Option Constant "DefaultArchitecture" "x86"
|
||||||
Set-Variable -Option Constant "DefaultRuntime" "clr"
|
Set-Variable -Option Constant "DefaultRuntime" "clr"
|
||||||
Set-Variable -Option Constant "AliasExtension" ".txt"
|
Set-Variable -Option Constant "AliasExtension" ".txt"
|
||||||
|
|
||||||
# These are intentionally using "%" syntax. The environment variables are expanded whenever the value is used.
|
# These are intentionally using "%" syntax. The environment variables are expanded whenever the value is used.
|
||||||
Set-Variable -Option Constant "OldUserHome" "%USERPROFILE%\.kre"
|
Set-Variable -Option Constant "OldUserHomes" @("%USERPROFILE%\.kre","%USERPROFILE%\.k")
|
||||||
Set-Variable -Option Constant "DefaultUserHome" "%USERPROFILE%\.k"
|
Set-Variable -Option Constant "DefaultUserHome" "%USERPROFILE%\$DefaultUserDirectoryName"
|
||||||
Set-Variable -Option Constant "HomeEnvVar" "KRE_HOME"
|
Set-Variable -Option Constant "HomeEnvVar" "DNX_HOME"
|
||||||
|
|
||||||
Set-Variable -Option Constant "AsciiArt" @"
|
Set-Variable -Option Constant "AsciiArt" @"
|
||||||
__ ___ ____ ___
|
___ _ ___ ____ ___
|
||||||
/ //_/ | / / |/ /
|
/ _ \/ |/ / | / / |/ /
|
||||||
/ ,< | |/ / /|_/ /
|
/ // / /| |/ / /|_/ /
|
||||||
/_/|_| |___/_/ /_/
|
/____/_/|_/ |___/_/ /_/
|
||||||
"@
|
"@
|
||||||
|
|
||||||
$ExitCodes = @{
|
$ExitCodes = @{
|
||||||
|
|
@ -102,7 +102,7 @@ $ExitCodes = @{
|
||||||
"InvalidArguments" = 1003
|
"InvalidArguments" = 1003
|
||||||
}
|
}
|
||||||
|
|
||||||
$ColorScheme = $KvmColors
|
$ColorScheme = $DnvmColors
|
||||||
if(!$ColorScheme) {
|
if(!$ColorScheme) {
|
||||||
$ColorScheme = @{
|
$ColorScheme = @{
|
||||||
"Banner"=[ConsoleColor]::Cyan
|
"Banner"=[ConsoleColor]::Cyan
|
||||||
|
|
@ -128,20 +128,20 @@ if($__TeeTo) {
|
||||||
$DeprecatedCommands = @("unalias")
|
$DeprecatedCommands = @("unalias")
|
||||||
|
|
||||||
# Load Environment variables
|
# Load Environment variables
|
||||||
$RuntimeHomes = $env:KRE_HOME
|
$RuntimeHomes = $env:DNX_HOME
|
||||||
$UserHome = $env:KRE_USER_HOME
|
$UserHome = $env:DNX_USER_HOME
|
||||||
$ActiveFeed = $env:KRE_FEED
|
$ActiveFeed = $env:DNX_FEED
|
||||||
|
|
||||||
# Default Exit Code
|
# Default Exit Code
|
||||||
$Script:ExitCode = $ExitCodes.Success
|
$Script:ExitCode = $ExitCodes.Success
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
### Below this point, the terms "KVM", "KRE", "K", etc. ###
|
### Below this point, the terms "DNVM", "DNX", etc. ###
|
||||||
### should never be used. Instead, use the Constants ###
|
### should never be used. Instead, use the Constants ###
|
||||||
### defined above ###
|
### defined above ###
|
||||||
############################################################
|
############################################################
|
||||||
# An exception to the above: The commands are defined by functions
|
# An exception to the above: The commands are defined by functions
|
||||||
# named "kvm-[command name]" so that extension functions can be added
|
# named "dnvm-[command name]" so that extension functions can be added
|
||||||
|
|
||||||
$StartPath = $env:PATH
|
$StartPath = $env:PATH
|
||||||
|
|
||||||
|
|
@ -513,20 +513,24 @@ function Change-Path() {
|
||||||
|
|
||||||
$newPath = $prependPath
|
$newPath = $prependPath
|
||||||
foreach($portion in $existingPaths.Split(';')) {
|
foreach($portion in $existingPaths.Split(';')) {
|
||||||
$skip = $portion -eq ""
|
if(![string]::IsNullOrWhiteSpace($portion)) {
|
||||||
foreach($removePath in $removePaths) {
|
$skip = $portion -eq ""
|
||||||
$removePrefix = if($removePath.EndsWith("\")) { $removePath } else { "$removePath\" }
|
foreach($removePath in $removePaths) {
|
||||||
|
if(![string]::IsNullOrWhiteSpace($removePath)) {
|
||||||
|
$removePrefix = if($removePath.EndsWith("\")) { $removePath } else { "$removePath\" }
|
||||||
|
|
||||||
if ($removePath -and (($portion -eq $removePath) -or ($portion.StartsWith($removePrefix)))) {
|
if ($removePath -and (($portion -eq $removePath) -or ($portion.StartsWith($removePrefix)))) {
|
||||||
_WriteDebug " Removing '$portion' because it matches '$removePath'"
|
_WriteDebug " Removing '$portion' because it matches '$removePath'"
|
||||||
$skip = $true
|
$skip = $true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!$skip) {
|
||||||
if (!$skip) {
|
if(![String]::IsNullOrWhiteSpace($newPath)) {
|
||||||
if(![String]::IsNullOrWhiteSpace($newPath)) {
|
$newPath += ";"
|
||||||
$newPath += ";"
|
}
|
||||||
|
$newPath += $portion
|
||||||
}
|
}
|
||||||
$newPath += $portion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $newPath
|
return $newPath
|
||||||
|
|
@ -596,21 +600,21 @@ function Is-Elevated() {
|
||||||
.PARAMETER Command
|
.PARAMETER Command
|
||||||
A specific command to get help for
|
A specific command to get help for
|
||||||
#>
|
#>
|
||||||
function kvm-help {
|
function dnvm-help {
|
||||||
[CmdletBinding(DefaultParameterSetName="GeneralHelp")]
|
[CmdletBinding(DefaultParameterSetName="GeneralHelp")]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,Position=0,ParameterSetName="SpecificCommand")][string]$Command,
|
[Parameter(Mandatory=$true,Position=0,ParameterSetName="SpecificCommand")][string]$Command,
|
||||||
[switch]$PassThru)
|
[switch]$PassThru)
|
||||||
|
|
||||||
if($Command) {
|
if($Command) {
|
||||||
$cmd = Get-Command "kvm-$Command" -ErrorAction SilentlyContinue
|
$cmd = Get-Command "dnvm-$Command" -ErrorAction SilentlyContinue
|
||||||
if(!$cmd) {
|
if(!$cmd) {
|
||||||
_WriteOut "No such command: $Command"
|
_WriteOut "No such command: $Command"
|
||||||
kvm-help
|
dnvm-help
|
||||||
$Script:ExitCodes = $ExitCodes.UnknownCommand
|
$Script:ExitCodes = $ExitCodes.UnknownCommand
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
$help = Get-Help "kvm-$Command"
|
$help = Get-Help "dnvm-$Command"
|
||||||
if($PassThru) {
|
if($PassThru) {
|
||||||
$help
|
$help
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -708,7 +712,7 @@ function kvm-help {
|
||||||
.PARAMETER PassThru
|
.PARAMETER PassThru
|
||||||
Set this switch to return unformatted powershell objects for use in scripting
|
Set this switch to return unformatted powershell objects for use in scripting
|
||||||
#>
|
#>
|
||||||
function kvm-list {
|
function dnvm-list {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$false)][switch]$PassThru)
|
[Parameter(Mandatory=$false)][switch]$PassThru)
|
||||||
$aliases = Get-RuntimeAlias
|
$aliases = Get-RuntimeAlias
|
||||||
|
|
@ -751,7 +755,7 @@ function kvm-list {
|
||||||
|
|
||||||
Finally, if the '-d' switch is provided, the alias <Name> is deleted, if it exists.
|
Finally, if the '-d' switch is provided, the alias <Name> is deleted, if it exists.
|
||||||
#>
|
#>
|
||||||
function kvm-alias {
|
function dnvm-alias {
|
||||||
param(
|
param(
|
||||||
[Alias("d")]
|
[Alias("d")]
|
||||||
[Parameter(ParameterSetName="Delete",Mandatory=$true)]
|
[Parameter(ParameterSetName="Delete",Mandatory=$true)]
|
||||||
|
|
@ -788,11 +792,11 @@ function kvm-alias {
|
||||||
.PARAMETER Name
|
.PARAMETER Name
|
||||||
The name of the alias to remove
|
The name of the alias to remove
|
||||||
#>
|
#>
|
||||||
function kvm-unalias {
|
function dnvm-unalias {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true,Position=0)][string]$Name)
|
[Parameter(Mandatory=$true,Position=0)][string]$Name)
|
||||||
_WriteOut "This command has been deprecated. Use '$CommandName alias -d' instead"
|
_WriteOut "This command has been deprecated. Use '$CommandName alias -d' instead"
|
||||||
kvm-alias -Delete -Name $Name
|
dnvm-alias -Delete -Name $Name
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
@ -811,9 +815,9 @@ function kvm-unalias {
|
||||||
.PARAMETER NoNative
|
.PARAMETER NoNative
|
||||||
Skip generation of native images
|
Skip generation of native images
|
||||||
.PARAMETER Ngen
|
.PARAMETER Ngen
|
||||||
For CLR flavor only. Ngen XRE libraries for faster startup. This option requires elevated privilege and will be automatically turned on if the script is running in administrative mode. To opt-out in administrative mode, use -NoNative switch.
|
For CLR flavor only. Generate native images for runtime libraries on Desktop CLR to improve startup time. This option requires elevated privilege and will be automatically turned on if the script is running in administrative mode. To opt-out in administrative mode, use -NoNative switch.
|
||||||
#>
|
#>
|
||||||
function kvm-upgrade {
|
function dnvm-upgrade {
|
||||||
param(
|
param(
|
||||||
[Alias("a")]
|
[Alias("a")]
|
||||||
[Parameter(Mandatory=$false, Position=0)]
|
[Parameter(Mandatory=$false, Position=0)]
|
||||||
|
|
@ -842,7 +846,7 @@ function kvm-upgrade {
|
||||||
[Parameter(Mandatory=$false)]
|
[Parameter(Mandatory=$false)]
|
||||||
[switch]$Ngen)
|
[switch]$Ngen)
|
||||||
|
|
||||||
kvm-install "latest" -Alias:$Alias -Architecture:$Architecture -Runtime:$Runtime -Force:$Force -Proxy:$Proxy -NoNative:$NoNative -Ngen:$Ngen
|
dnvm-install "latest" -Alias:$Alias -Architecture:$Architecture -Runtime:$Runtime -Force:$Force -Proxy:$Proxy -NoNative:$NoNative -Ngen:$Ngen
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
@ -864,13 +868,12 @@ function kvm-upgrade {
|
||||||
.PARAMETER NoNative
|
.PARAMETER NoNative
|
||||||
Skip generation of native images
|
Skip generation of native images
|
||||||
.PARAMETER Ngen
|
.PARAMETER Ngen
|
||||||
For CLR flavor only. Ngen XRE libraries for faster startup. This option requires elevated privilege and will be automatically turned on if the script is running in administrative mode. To opt-out in administrative mode, use -NoNative switch.
|
For CLR flavor only. Generate native images for runtime libraries on Desktop CLR to improve startup time. This option requires elevated privilege and will be automatically turned on if the script is running in administrative mode. To opt-out in administrative mode, use -NoNative switch.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
A proxy can also be specified by using the 'http_proxy' environment variable
|
A proxy can also be specified by using the 'http_proxy' environment variable
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function kvm-install {
|
function dnvm-install {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$false, Position=0)]
|
[Parameter(Mandatory=$false, Position=0)]
|
||||||
[string]$VersionOrNuPkg,
|
[string]$VersionOrNuPkg,
|
||||||
|
|
@ -904,7 +907,7 @@ function kvm-install {
|
||||||
|
|
||||||
if(!$VersionOrNuPkg) {
|
if(!$VersionOrNuPkg) {
|
||||||
_WriteOut "A version, nupkg path, or the string 'latest' must be provided."
|
_WriteOut "A version, nupkg path, or the string 'latest' must be provided."
|
||||||
kvm-help install
|
dnvm-help install
|
||||||
$Script:ExitCode = $ExitCodes.InvalidArguments
|
$Script:ExitCode = $ExitCodes.InvalidArguments
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -974,7 +977,7 @@ function kvm-install {
|
||||||
_WriteDebug "Cleaning temporary directory $UnpackFolder"
|
_WriteDebug "Cleaning temporary directory $UnpackFolder"
|
||||||
Remove-Item $UnpackFolder -Force | Out-Null
|
Remove-Item $UnpackFolder -Force | Out-Null
|
||||||
|
|
||||||
kvm-use $PackageVersion -Architecture:$Architecture -Runtime:$Runtime
|
dnvm-use $PackageVersion -Architecture:$Architecture -Runtime:$Runtime
|
||||||
|
|
||||||
if ($Runtime -eq "clr") {
|
if ($Runtime -eq "clr") {
|
||||||
if (-not $NoNative) {
|
if (-not $NoNative) {
|
||||||
|
|
@ -1004,7 +1007,7 @@ function kvm-install {
|
||||||
|
|
||||||
if($Alias) {
|
if($Alias) {
|
||||||
_WriteDebug "Aliasing installed runtime to '$Alias'"
|
_WriteDebug "Aliasing installed runtime to '$Alias'"
|
||||||
kvm-alias $Alias $PackageVersion -Architecture:$Architecture -Runtime:$Runtime
|
dnvm-alias $Alias $PackageVersion -Architecture:$Architecture -Runtime:$Runtime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1021,7 +1024,7 @@ function kvm-install {
|
||||||
.PARAMETER Persistent
|
.PARAMETER Persistent
|
||||||
Make the change persistent across all processes run by the current user
|
Make the change persistent across all processes run by the current user
|
||||||
#>
|
#>
|
||||||
function kvm-use {
|
function dnvm-use {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$false, Position=0)]
|
[Parameter(Mandatory=$false, Position=0)]
|
||||||
[string]$VersionOrAlias,
|
[string]$VersionOrAlias,
|
||||||
|
|
@ -1042,7 +1045,7 @@ function kvm-use {
|
||||||
|
|
||||||
if([String]::IsNullOrWhiteSpace($VersionOrAlias)) {
|
if([String]::IsNullOrWhiteSpace($VersionOrAlias)) {
|
||||||
_WriteOut "Missing version or alias to add to path"
|
_WriteOut "Missing version or alias to add to path"
|
||||||
kvm-help use
|
dnvm-help use
|
||||||
$Script:ExitCode = $ExitCodes.InvalidArguments
|
$Script:ExitCode = $ExitCodes.InvalidArguments
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1087,7 +1090,7 @@ function kvm-use {
|
||||||
.PARAMETER Runtime
|
.PARAMETER Runtime
|
||||||
The runtime flavor of the runtime to place on the PATH (default: clr, or whatever the alias specifies in the case of use-ing an alias)
|
The runtime flavor of the runtime to place on the PATH (default: clr, or whatever the alias specifies in the case of use-ing an alias)
|
||||||
#>
|
#>
|
||||||
function kvm-name {
|
function dnvm-name {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$false, Position=0)]
|
[Parameter(Mandatory=$false, Position=0)]
|
||||||
[string]$VersionOrAlias,
|
[string]$VersionOrAlias,
|
||||||
|
|
@ -1109,9 +1112,9 @@ function kvm-name {
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Installs the version manager into your User profile directory
|
Installs the version manager into your User profile directory
|
||||||
.PARAMETER SkipUserEnvironmentInstall
|
.PARAMETER SkipUserEnvironmentInstall
|
||||||
Set this switch to skip configuring the user-level KRE_HOME and PATH environment variables
|
Set this switch to skip configuring the user-level DNX_HOME and PATH environment variables
|
||||||
#>
|
#>
|
||||||
function kvm-setup {
|
function dnvm-setup {
|
||||||
param(
|
param(
|
||||||
[switch]$SkipUserEnvironmentInstall)
|
[switch]$SkipUserEnvironmentInstall)
|
||||||
|
|
||||||
|
|
@ -1182,7 +1185,7 @@ function kvm-setup {
|
||||||
|
|
||||||
### The main "entry point"
|
### The main "entry point"
|
||||||
|
|
||||||
# Check for old KRE_HOME values
|
# Check for old DNX_HOME values
|
||||||
if($UnencodedHomes -contains $OldUserHome) {
|
if($UnencodedHomes -contains $OldUserHome) {
|
||||||
_WriteOut -ForegroundColor Yellow "WARNING: Found '$OldUserHome' in your $HomeEnvVar value. This folder has been deprecated."
|
_WriteOut -ForegroundColor Yellow "WARNING: Found '$OldUserHome' in your $HomeEnvVar value. This folder has been deprecated."
|
||||||
if($UnencodedHomes -notcontains $DefaultUserHome) {
|
if($UnencodedHomes -notcontains $DefaultUserHome) {
|
||||||
|
|
@ -1222,12 +1225,12 @@ if(!$cmd) {
|
||||||
|
|
||||||
# Check for the command
|
# Check for the command
|
||||||
if(Get-Command -Name "$CommandPrefix$cmd" -ErrorAction SilentlyContinue) {
|
if(Get-Command -Name "$CommandPrefix$cmd" -ErrorAction SilentlyContinue) {
|
||||||
_WriteDebug "& kvm-$cmd $cmdargs"
|
_WriteDebug "& dnvm-$cmd $cmdargs"
|
||||||
& "kvm-$cmd" @cmdargs
|
& "dnvm-$cmd" @cmdargs
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_WriteOut "Unknown command: '$cmd'"
|
_WriteOut "Unknown command: '$cmd'"
|
||||||
kvm-help
|
dnvm-help
|
||||||
$Script:ExitCode = $ExitCodes.UnknownCommand
|
$Script:ExitCode = $ExitCodes.UnknownCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
126
kvm.sh → dnvm.sh
126
kvm.sh → dnvm.sh
|
|
@ -1,15 +1,15 @@
|
||||||
# dnvm.sh
|
# dnvm.sh
|
||||||
# Source this file from your .bash-profile or script to use
|
# Source this file from your .bash-profile or script to use
|
||||||
|
|
||||||
# "Constants"
|
# "Constants"
|
||||||
_DNVM_BUILDNUMBER="beta4-10333"
|
_DNVM_BUILDNUMBER="beta4-10336"
|
||||||
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
|
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
|
||||||
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
|
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
|
||||||
_DNVM_RUNTIME_FRIENDLY_NAME="K Runtime"
|
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
|
||||||
_DNVM_RUNTIME_SHORT_NAME="DNX"
|
_DNVM_RUNTIME_SHORT_NAME="DNX"
|
||||||
_DNVM_RUNTIME_FOLDER_NAME=".k"
|
_DNVM_RUNTIME_FOLDER_NAME=".dnx"
|
||||||
_DNVM_COMMAND_NAME="dnvm"
|
_DNVM_COMMAND_NAME="dnvm"
|
||||||
_DNVM_VERSION_MANAGER_NAME="K Version Manager"
|
_DNVM_VERSION_MANAGER_NAME=".NET Version Manager"
|
||||||
_DNVM_DEFAULT_FEED="https://www.myget.org/F/aspnetvnext/api/v2"
|
_DNVM_DEFAULT_FEED="https://www.myget.org/F/aspnetvnext/api/v2"
|
||||||
_DNVM_HOME_VAR_NAME="DNX_HOME"
|
_DNVM_HOME_VAR_NAME="DNX_HOME"
|
||||||
|
|
||||||
|
|
@ -24,12 +24,12 @@ if __dnvm_has "unsetopt"; then
|
||||||
unsetopt nomatch 2>/dev/null
|
unsetopt nomatch 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$DNVM_USER_HOME" ]; then
|
if [ -z "$DNX_USER_HOME" ]; then
|
||||||
eval DNVM_USER_HOME="~/$_DNVM_RUNTIME_FOLDER_NAME"
|
eval DNX_USER_HOME="~/$_DNVM_RUNTIME_FOLDER_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_DNVM_USER_PACKAGES="$DNVM_USER_HOME/runtimes"
|
_DNVM_USER_PACKAGES="$DNX_USER_HOME/runtimes"
|
||||||
_DNVM_ALIAS_DIR="$DNVM_USER_HOME/alias"
|
_DNVM_ALIAS_DIR="$DNX_USER_HOME/alias"
|
||||||
|
|
||||||
if [ -z "$DNX_FEED" ]; then
|
if [ -z "$DNX_FEED" ]; then
|
||||||
DNX_FEED="$_DNVM_DEFAULT_FEED"
|
DNX_FEED="$_DNVM_DEFAULT_FEED"
|
||||||
|
|
@ -147,7 +147,7 @@ __dnvm_requested_version_or_alias() {
|
||||||
local runtimeFullName=$(cat "$_DNVM_ALIAS_DIR/$versionOrAlias.alias")
|
local runtimeFullName=$(cat "$_DNVM_ALIAS_DIR/$versionOrAlias.alias")
|
||||||
local pkgName=$(echo $runtimeFullName | sed "s/\([^.]*\).*/\1/")
|
local pkgName=$(echo $runtimeFullName | sed "s/\([^.]*\).*/\1/")
|
||||||
local pkgVersion=$(echo $runtimeFullName | sed "s/[^.]*.\(.*\)/\1/")
|
local pkgVersion=$(echo $runtimeFullName | sed "s/[^.]*.\(.*\)/\1/")
|
||||||
local pkgPlatform=$(echo "$pkgName" | sed "s/dnx-\([^.-]*\).*/\1/")
|
local pkgPlatform=$(echo "$pkgName" | sed "s/$_DNVM_RUNTIME_PACKAGE_NAME-\([^.-]*\).*/\1/")
|
||||||
else
|
else
|
||||||
local pkgVersion=$versionOrAlias
|
local pkgVersion=$versionOrAlias
|
||||||
local pkgPlatform="mono"
|
local pkgPlatform="mono"
|
||||||
|
|
@ -163,64 +163,68 @@ __dnvm_locate_runtime_bin_from_full_name() {
|
||||||
[ -e "$_DNVM_USER_PACKAGES/$runtimeFullName/bin" ] && echo "$_DNVM_USER_PACKAGES/$runtimeFullName/bin" && return
|
[ -e "$_DNVM_USER_PACKAGES/$runtimeFullName/bin" ] && echo "$_DNVM_USER_PACKAGES/$runtimeFullName/bin" && return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__dnvm_help() {
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_VERSION_MANAGER_NAME - Version 1.0.0-$_DNVM_BUILDNUMBER"
|
||||||
|
[ "$_DNVM_AUTHORS" != "{{*" ] && echo "By $_DNVM_AUTHORS"
|
||||||
|
echo ""
|
||||||
|
echo "USAGE: $_DNVM_COMMAND_NAME <command> [options]"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME upgrade"
|
||||||
|
echo "install latest $_DNVM_RUNTIME_SHORT_NAME from feed"
|
||||||
|
echo "add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
|
||||||
|
echo "set installed version as default"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME install <semver>|<alias>|<nupkg>|latest [-a|-alias <alias>] [-p -persistent]"
|
||||||
|
echo "<semver>|<alias> install requested $_DNVM_RUNTIME_SHORT_NAME from feed"
|
||||||
|
echo "<nupkg> install requested $_DNVM_RUNTIME_SHORT_NAME from local package on filesystem"
|
||||||
|
echo "latest install latest version of $_DNVM_RUNTIME_SHORT_NAME from feed"
|
||||||
|
echo "-a|-alias <alias> set alias <alias> for requested $_DNVM_RUNTIME_SHORT_NAME on install"
|
||||||
|
echo "-p -persistent set installed version as default"
|
||||||
|
echo "add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME use <semver>|<alias>|<package>|none [-p -persistent]"
|
||||||
|
echo "<semver>|<alias>|<package> add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line "
|
||||||
|
echo "none remove $_DNVM_RUNTIME_SHORT_NAME bin from path of current command line"
|
||||||
|
echo "-p -persistent set selected version as default"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME list"
|
||||||
|
echo "list $_DNVM_RUNTIME_SHORT_NAME versions installed "
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME alias"
|
||||||
|
echo "list $_DNVM_RUNTIME_SHORT_NAME aliases which have been defined"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME alias <alias>"
|
||||||
|
echo "display value of the specified alias"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME alias <alias> <semver>|<alias>|<package>"
|
||||||
|
echo "<alias> the name of the alias to set"
|
||||||
|
echo "<semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
|
||||||
|
echo ""
|
||||||
|
echo "$_DNVM_COMMAND_NAME unalias <alias>"
|
||||||
|
echo "remove the specified alias"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
dnvm()
|
dnvm()
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
$_DNVM_COMMAND_NAME help
|
__dnvm_help
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"help" )
|
"help" )
|
||||||
echo ""
|
__dnvm_help
|
||||||
echo "$_DNVM_VERSION_MANAGER_NAME - Version 1.0.0-$_DNVM_BUILDNUMBER"
|
|
||||||
[ "$_DNVM_AUTHORS" != "{{*" ] && echo "By $_DNVM_AUTHORS"
|
|
||||||
echo ""
|
|
||||||
echo "USAGE: $_DNVM_COMMAND_NAME <command> [options]"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME upgrade"
|
|
||||||
echo "install latest $_DNVM_RUNTIME_SHORT_NAME from feed"
|
|
||||||
echo "add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
|
|
||||||
echo "set installed version as default"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME install <semver>|<alias>|<nupkg>|latest [-a|-alias <alias>] [-p -persistent]"
|
|
||||||
echo "<semver>|<alias> install requested $_DNVM_RUNTIME_SHORT_NAME from feed"
|
|
||||||
echo "<nupkg> install requested $_DNVM_RUNTIME_SHORT_NAME from local package on filesystem"
|
|
||||||
echo "latest install latest version of $_DNVM_RUNTIME_SHORT_NAME from feed"
|
|
||||||
echo "-a|-alias <alias> set alias <alias> for requested $_DNVM_RUNTIME_SHORT_NAME on install"
|
|
||||||
echo "-p -persistent set installed version as default"
|
|
||||||
echo "add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME use <semver>|<alias>|<package>|none [-p -persistent]"
|
|
||||||
echo "<semver>|<alias>|<package> add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line "
|
|
||||||
echo "none remove $_DNVM_RUNTIME_SHORT_NAME bin from path of current command line"
|
|
||||||
echo "-p -persistent set selected version as default"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME list"
|
|
||||||
echo "list $_DNVM_RUNTIME_SHORT_NAME versions installed "
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME alias"
|
|
||||||
echo "list $_DNVM_RUNTIME_SHORT_NAME aliases which have been defined"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME alias <alias>"
|
|
||||||
echo "display value of the specified alias"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME alias <alias> <semver>|<alias>|<package>"
|
|
||||||
echo "<alias> the name of the alias to set"
|
|
||||||
echo "<semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
|
|
||||||
echo ""
|
|
||||||
echo "$_DNVM_COMMAND_NAME unalias <alias>"
|
|
||||||
echo "remove the specified alias"
|
|
||||||
echo ""
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"upgrade" )
|
"upgrade" )
|
||||||
[ $# -ne 1 ] && dnvm help && return
|
[ $# -ne 1 ] && __dnvm_help && return
|
||||||
$_DNVM_COMMAND_NAME install latest -p
|
$_DNVM_COMMAND_NAME install latest -p
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"install" )
|
"install" )
|
||||||
[ $# -lt 2 ] && dnvm help && return
|
[ $# -lt 2 ] && __dnvm_help && return
|
||||||
shift
|
shift
|
||||||
local persistent=
|
local persistent=
|
||||||
local versionOrAlias=
|
local versionOrAlias=
|
||||||
|
|
@ -233,7 +237,7 @@ dnvm()
|
||||||
local alias=$2
|
local alias=$2
|
||||||
shift
|
shift
|
||||||
elif [[ -n $1 ]]; then
|
elif [[ -n $1 ]]; then
|
||||||
[[ -n $versionOrAlias ]] && echo "Invalid option $1" && dnvm help && return 1
|
[[ -n $versionOrAlias ]] && echo "Invalid option $1" && __dnvm_help && return 1
|
||||||
local versionOrAlias=$1
|
local versionOrAlias=$1
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
@ -259,20 +263,20 @@ dnvm()
|
||||||
[[ $? == 1 ]] && return 1
|
[[ $? == 1 ]] && return 1
|
||||||
fi
|
fi
|
||||||
$_DNVM_COMMAND_NAME use "$runtimeVersion" "$persistent"
|
$_DNVM_COMMAND_NAME use "$runtimeVersion" "$persistent"
|
||||||
[[ -n $alias ]] && dnvm alias "$alias" "$runtimeVersion"
|
[[ -n $alias ]] && $_DNVM_COMMAND_NAME alias "$alias" "$runtimeVersion"
|
||||||
else
|
else
|
||||||
local runtimeFullName="$(__dnvm_requested_version_or_alias $versionOrAlias)"
|
local runtimeFullName="$(__dnvm_requested_version_or_alias $versionOrAlias)"
|
||||||
local runtimeFolder="$_DNVM_USER_PACKAGES/$runtimeFullName"
|
local runtimeFolder="$_DNVM_USER_PACKAGES/$runtimeFullName"
|
||||||
__dnvm_download "$runtimeFullName" "$runtimeFolder"
|
__dnvm_download "$runtimeFullName" "$runtimeFolder"
|
||||||
[[ $? == 1 ]] && return 1
|
[[ $? == 1 ]] && return 1
|
||||||
$_DNVM_COMMAND_NAME use "$versionOrAlias" "$persistent"
|
$_DNVM_COMMAND_NAME use "$versionOrAlias" "$persistent"
|
||||||
[[ -n $alias ]] && dnvm alias "$alias" "$versionOrAlias"
|
[[ -n $alias ]] && $_DNVM_COMMAND_NAME alias "$alias" "$versionOrAlias"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"use" )
|
"use" )
|
||||||
[ $# -gt 3 ] && $_DNVM_COMMAND_NAME help && return
|
[ $# -gt 3 ] && __dnvm_help && return
|
||||||
[ $# -lt 2 ] && $_DNVM_COMMAND_NAME help && return
|
[ $# -lt 2 ] && __dnvm_help && return
|
||||||
|
|
||||||
shift
|
shift
|
||||||
local persistent=
|
local persistent=
|
||||||
|
|
@ -318,7 +322,7 @@ dnvm()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"alias" )
|
"alias" )
|
||||||
[[ $# -gt 3 ]] && dnvm help && return
|
[[ $# -gt 3 ]] && __dnvm_help && return
|
||||||
|
|
||||||
[[ ! -e "$_DNVM_ALIAS_DIR/" ]] && mkdir "$_DNVM_ALIAS_DIR/" > /dev/null
|
[[ ! -e "$_DNVM_ALIAS_DIR/" ]] && mkdir "$_DNVM_ALIAS_DIR/" > /dev/null
|
||||||
|
|
||||||
|
|
@ -358,7 +362,7 @@ dnvm()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"unalias" )
|
"unalias" )
|
||||||
[[ $# -ne 2 ]] && dnvm help && return
|
[[ $# -ne 2 ]] && __dnvm_help && return
|
||||||
|
|
||||||
local name=$2
|
local name=$2
|
||||||
local aliasPath="$_DNVM_ALIAS_DIR/$name.alias"
|
local aliasPath="$_DNVM_ALIAS_DIR/$name.alias"
|
||||||
|
|
@ -368,7 +372,7 @@ dnvm()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"list" )
|
"list" )
|
||||||
[[ $# -gt 2 ]] && dnvm help && return
|
[[ $# -gt 2 ]] && __dnvm_help && return
|
||||||
|
|
||||||
[[ ! -d $_DNVM_USER_PACKAGES ]] && echo "$_DNVM_RUNTIME_FRIENDLY_NAME is not installed." && return 1
|
[[ ! -d $_DNVM_USER_PACKAGES ]] && echo "$_DNVM_RUNTIME_FRIENDLY_NAME is not installed." && return 1
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
$tempPath = Join-Path $env:TEMP "dnvminstall"
|
||||||
|
$kvmPs1Path = Join-Path $tempPath "dnvm.ps1"
|
||||||
|
$kvmCmdPath = Join-Path $tempPath "dnvm.cmd"
|
||||||
|
|
||||||
|
Write-Host "Using temporary directory: $tempPath"
|
||||||
|
if (!(Test-Path $tempPath)) { md $tempPath | Out-Null }
|
||||||
|
|
||||||
|
|
||||||
|
$webClient = New-Object System.Net.WebClient
|
||||||
|
Write-Host "Downloading DNVM.ps1 to $dnvmPs1Path"
|
||||||
|
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.ps1', $kvmPs1Path)
|
||||||
|
Write-Host "Downloading DNVM.cmd to $dnvmCmdPath"
|
||||||
|
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.cmd', $kvmCmdPath)
|
||||||
|
Write-Host "Installing DNVM"
|
||||||
|
& $kvmCmdPath setup
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
$tempPath = Join-Path $env:TEMP "kvminstall"
|
|
||||||
$kvmPs1Path = Join-Path $tempPath "kvm.ps1"
|
|
||||||
$kvmCmdPath = Join-Path $tempPath "kvm.cmd"
|
|
||||||
|
|
||||||
Write-Host "Using temporary directory: $tempPath"
|
|
||||||
if (!(Test-Path $tempPath)) { md $tempPath | Out-Null }
|
|
||||||
|
|
||||||
|
|
||||||
$webClient = New-Object System.Net.WebClient
|
|
||||||
Write-Host "Downloading KVM.ps1 to $kvmPs1Path"
|
|
||||||
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/kvm.ps1', $kvmPs1Path)
|
|
||||||
Write-Host "Downloading KVM.cmd to $kvmCmdPath"
|
|
||||||
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/dev/kvm.cmd', $kvmCmdPath)
|
|
||||||
Write-Host "Installing KVM"
|
|
||||||
& $kvmCmdPath setup
|
|
||||||
Loading…
Reference in New Issue