Update dnvm
This commit is contained in:
parent
207e97db7a
commit
b1c2447073
|
|
@ -1,6 +1,6 @@
|
||||||
@Echo off
|
@Echo off
|
||||||
|
|
||||||
set DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
|
for /f "delims=" %%i in ('PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.IO.Path]::GetTempFileName()"') do set DNVM_CMD_PATH_FILE=%%i
|
||||||
|
|
||||||
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' %*"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ function _WriteOut {
|
||||||
|
|
||||||
### Constants
|
### Constants
|
||||||
$ProductVersion="1.0.0"
|
$ProductVersion="1.0.0"
|
||||||
$BuildVersion="rc1-15523"
|
$BuildVersion="rc1-15533"
|
||||||
$Authors="Microsoft Open Technologies, Inc."
|
$Authors="Microsoft Open Technologies, Inc."
|
||||||
|
|
||||||
# If the Version hasn't been replaced...
|
# If the Version hasn't been replaced...
|
||||||
|
|
@ -846,6 +846,14 @@ function Is-Elevated() {
|
||||||
return $user.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
return $user.IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-ScriptRoot() {
|
||||||
|
if ($PSVersionTable.PSVersion.Major -ge 3) {
|
||||||
|
return $PSScriptRoot
|
||||||
|
}
|
||||||
|
|
||||||
|
return Split-Path $script:MyInvocation.MyCommand.Path -Parent
|
||||||
|
}
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
|
@ -863,9 +871,10 @@ function dnvm-update-self {
|
||||||
$wc = New-Object System.Net.WebClient
|
$wc = New-Object System.Net.WebClient
|
||||||
Apply-Proxy $wc -Proxy:$Proxy
|
Apply-Proxy $wc -Proxy:$Proxy
|
||||||
|
|
||||||
$dnvmFile = Join-Path $PSScriptRoot "dnvm.ps1"
|
$CurrentScriptRoot = Get-ScriptRoot
|
||||||
$tempDnvmFile = Join-Path $PSScriptRoot "temp"
|
$dnvmFile = Join-Path $CurrentScriptRoot "dnvm.ps1"
|
||||||
$backupFilePath = Join-Path $PSSCriptRoot "dnvm.ps1.bak"
|
$tempDnvmFile = Join-Path $CurrentScriptRoot "temp"
|
||||||
|
$backupFilePath = Join-Path $CurrentScriptRoot "dnvm.ps1.bak"
|
||||||
|
|
||||||
$wc.DownloadFile($DNVMUpgradeUrl, $tempDnvmFile)
|
$wc.DownloadFile($DNVMUpgradeUrl, $tempDnvmFile)
|
||||||
|
|
||||||
|
|
@ -1369,10 +1378,10 @@ function dnvm-install {
|
||||||
if (!$IsNuPkg) {
|
if (!$IsNuPkg) {
|
||||||
if ($VersionNuPkgOrAlias -eq "latest") {
|
if ($VersionNuPkgOrAlias -eq "latest") {
|
||||||
Write-Progress -Activity "Installing runtime" -Status "Determining latest runtime" -Id 1
|
Write-Progress -Activity "Installing runtime" -Status "Determining latest runtime" -Id 1
|
||||||
$findPackageResult = Find-Latest -runtimeInfo:$runtimeInfo -Feed:$selectedFeed
|
$findPackageResult = Find-Latest -runtimeInfo:$runtimeInfo -Feed:$selectedFeed -Proxy:$Proxy
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$findPackageResult = Find-Package -runtimeInfo:$runtimeInfo -Feed:$selectedFeed
|
$findPackageResult = Find-Package -runtimeInfo:$runtimeInfo -Feed:$selectedFeed -Proxy:$Proxy
|
||||||
}
|
}
|
||||||
$Version = $findPackageResult.Version
|
$Version = $findPackageResult.Version
|
||||||
}
|
}
|
||||||
|
|
@ -1848,10 +1857,17 @@ if(Test-Path env:\KRE_HOME) {
|
||||||
|
|
||||||
$cmd = $args[0]
|
$cmd = $args[0]
|
||||||
|
|
||||||
|
$cmdargs = @()
|
||||||
if($args.Length -gt 1) {
|
if($args.Length -gt 1) {
|
||||||
$cmdargs = @($args[1..($args.Length-1)])
|
# Combine arguments, ensuring any containing whitespace or parenthesis are correctly quoted
|
||||||
} else {
|
ForEach ($arg In $args[1..($args.Length-1)]) {
|
||||||
$cmdargs = @()
|
if ($arg -match "[\s\(\)]") {
|
||||||
|
$cmdargs += """$arg"""
|
||||||
|
} else {
|
||||||
|
$cmdargs += $arg
|
||||||
|
}
|
||||||
|
$cmdargs += " "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Can't add this as script-level arguments because they mask '-a' arguments in subcommands!
|
# Can't add this as script-level arguments because they mask '-a' arguments in subcommands!
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# 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="rc1-15523"
|
_DNVM_BUILDNUMBER="rc1-15533"
|
||||||
_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=".NET Execution Environment"
|
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
|
||||||
|
|
@ -38,6 +38,10 @@ __dnvm_has() {
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__dnvm_to_lower() {
|
||||||
|
echo "$1" | tr '[:upper:]' '[:lower:]'
|
||||||
|
}
|
||||||
|
|
||||||
if __dnvm_has "unsetopt"; then
|
if __dnvm_has "unsetopt"; then
|
||||||
unsetopt nomatch 2>/dev/null
|
unsetopt nomatch 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
@ -550,15 +554,15 @@ dnvm()
|
||||||
elif [[ $1 == "-u" || $1 == "-unstable" ]]; then
|
elif [[ $1 == "-u" || $1 == "-unstable" ]]; then
|
||||||
local unstable="-u"
|
local unstable="-u"
|
||||||
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
||||||
local runtime=$2
|
local runtime=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-OS" ]]; then
|
elif [[ $1 == "-OS" ]]; then
|
||||||
local os=$2
|
local os=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-y" ]]; then
|
elif [[ $1 == "-y" ]]; then
|
||||||
local acceptSudo=1
|
local acceptSudo=1
|
||||||
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
||||||
local arch=$2
|
local arch=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [[ $arch != "x86" && $arch != "x64" ]]; then
|
if [[ $arch != "x86" && $arch != "x64" ]]; then
|
||||||
|
|
@ -697,13 +701,13 @@ dnvm()
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
do
|
do
|
||||||
if [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
if [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
||||||
local runtime=$2
|
local runtime=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
||||||
local architecture=$2
|
local architecture=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-OS" ]]; then
|
elif [[ $1 == "-OS" ]]; then
|
||||||
local os=$2
|
local os=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-y" ]]; then
|
elif [[ $1 == "-y" ]]; then
|
||||||
local acceptSudo=1
|
local acceptSudo=1
|
||||||
|
|
@ -774,10 +778,10 @@ dnvm()
|
||||||
if [[ $1 == "-p" || $1 == "-persistent" ]]; then
|
if [[ $1 == "-p" || $1 == "-persistent" ]]; then
|
||||||
local persistent="true"
|
local persistent="true"
|
||||||
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
|
||||||
local arch=$2
|
local arch=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
||||||
local runtime=$2
|
local runtime=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == -* ]]; then
|
elif [[ $1 == -* ]]; then
|
||||||
echo "Invalid option $1" && __dnvm_help && return 1
|
echo "Invalid option $1" && __dnvm_help && return 1
|
||||||
|
|
@ -791,10 +795,10 @@ dnvm()
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
do
|
do
|
||||||
if [[ $1 == "-a" || $1 == "-arch" ]]; then
|
if [[ $1 == "-a" || $1 == "-arch" ]]; then
|
||||||
local arch=$2
|
local arch=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
||||||
local runtime=$2
|
local runtime=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ -n $1 ]]; then
|
elif [[ -n $1 ]]; then
|
||||||
[[ -n $versionOrAlias ]] && break
|
[[ -n $versionOrAlias ]] && break
|
||||||
|
|
@ -857,7 +861,7 @@ dnvm()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"alias" )
|
"alias" )
|
||||||
[[ $# -gt 7 ]] && __dnvm_help && return
|
[[ $# -gt 9 ]] && __dnvm_help && return
|
||||||
|
|
||||||
[[ ! -e "$_DNVM_ALIAS_DIR/" ]] && mkdir "$_DNVM_ALIAS_DIR/" > /dev/null
|
[[ ! -e "$_DNVM_ALIAS_DIR/" ]] && mkdir "$_DNVM_ALIAS_DIR/" > /dev/null
|
||||||
|
|
||||||
|
|
@ -902,13 +906,13 @@ dnvm()
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
do
|
do
|
||||||
if [[ $1 == "-a" || $1 == "-arch" ]]; then
|
if [[ $1 == "-a" || $1 == "-arch" ]]; then
|
||||||
local arch=$2
|
local arch=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
|
||||||
local runtime=$2
|
local runtime=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 == "-OS" ]]; then
|
elif [[ $1 == "-OS" ]]; then
|
||||||
local os=$2
|
local os=$(__dnvm_to_lower "$2")
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue