Update dnvm

This commit is contained in:
Brennan 2015-10-26 14:12:16 -07:00
parent 207e97db7a
commit b1c2447073
3 changed files with 45 additions and 25 deletions

View File

@ -1,6 +1,6 @@
@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' %*"

View File

@ -67,7 +67,7 @@ function _WriteOut {
### Constants
$ProductVersion="1.0.0"
$BuildVersion="rc1-15523"
$BuildVersion="rc1-15533"
$Authors="Microsoft Open Technologies, Inc."
# If the Version hasn't been replaced...
@ -846,6 +846,14 @@ function Is-Elevated() {
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
<#
@ -863,9 +871,10 @@ function dnvm-update-self {
$wc = New-Object System.Net.WebClient
Apply-Proxy $wc -Proxy:$Proxy
$dnvmFile = Join-Path $PSScriptRoot "dnvm.ps1"
$tempDnvmFile = Join-Path $PSScriptRoot "temp"
$backupFilePath = Join-Path $PSSCriptRoot "dnvm.ps1.bak"
$CurrentScriptRoot = Get-ScriptRoot
$dnvmFile = Join-Path $CurrentScriptRoot "dnvm.ps1"
$tempDnvmFile = Join-Path $CurrentScriptRoot "temp"
$backupFilePath = Join-Path $CurrentScriptRoot "dnvm.ps1.bak"
$wc.DownloadFile($DNVMUpgradeUrl, $tempDnvmFile)
@ -1369,10 +1378,10 @@ function dnvm-install {
if (!$IsNuPkg) {
if ($VersionNuPkgOrAlias -eq "latest") {
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 {
$findPackageResult = Find-Package -runtimeInfo:$runtimeInfo -Feed:$selectedFeed
$findPackageResult = Find-Package -runtimeInfo:$runtimeInfo -Feed:$selectedFeed -Proxy:$Proxy
}
$Version = $findPackageResult.Version
}
@ -1848,10 +1857,17 @@ if(Test-Path env:\KRE_HOME) {
$cmd = $args[0]
$cmdargs = @()
if($args.Length -gt 1) {
$cmdargs = @($args[1..($args.Length-1)])
} else {
$cmdargs = @()
# Combine arguments, ensuring any containing whitespace or parenthesis are correctly quoted
ForEach ($arg In $args[1..($args.Length-1)]) {
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!

View File

@ -2,7 +2,7 @@
# Source this file from your .bash-profile or script to use
# "Constants"
_DNVM_BUILDNUMBER="rc1-15523"
_DNVM_BUILDNUMBER="rc1-15533"
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
@ -38,6 +38,10 @@ __dnvm_has() {
return $?
}
__dnvm_to_lower() {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
if __dnvm_has "unsetopt"; then
unsetopt nomatch 2>/dev/null
fi
@ -550,15 +554,15 @@ dnvm()
elif [[ $1 == "-u" || $1 == "-unstable" ]]; then
local unstable="-u"
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
local runtime=$2
local runtime=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-OS" ]]; then
local os=$2
local os=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-y" ]]; then
local acceptSudo=1
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
local arch=$2
local arch=$(__dnvm_to_lower "$2")
shift
if [[ $arch != "x86" && $arch != "x64" ]]; then
@ -697,13 +701,13 @@ dnvm()
while [ $# -ne 0 ]
do
if [[ $1 == "-r" || $1 == "-runtime" ]]; then
local runtime=$2
local runtime=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
local architecture=$2
local architecture=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-OS" ]]; then
local os=$2
local os=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-y" ]]; then
local acceptSudo=1
@ -774,10 +778,10 @@ dnvm()
if [[ $1 == "-p" || $1 == "-persistent" ]]; then
local persistent="true"
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
local arch=$2
local arch=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
local runtime=$2
local runtime=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == -* ]]; then
echo "Invalid option $1" && __dnvm_help && return 1
@ -791,10 +795,10 @@ dnvm()
while [ $# -ne 0 ]
do
if [[ $1 == "-a" || $1 == "-arch" ]]; then
local arch=$2
local arch=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
local runtime=$2
local runtime=$(__dnvm_to_lower "$2")
shift
elif [[ -n $1 ]]; then
[[ -n $versionOrAlias ]] && break
@ -857,7 +861,7 @@ dnvm()
;;
"alias" )
[[ $# -gt 7 ]] && __dnvm_help && return
[[ $# -gt 9 ]] && __dnvm_help && return
[[ ! -e "$_DNVM_ALIAS_DIR/" ]] && mkdir "$_DNVM_ALIAS_DIR/" > /dev/null
@ -902,13 +906,13 @@ dnvm()
while [ $# -ne 0 ]
do
if [[ $1 == "-a" || $1 == "-arch" ]]; then
local arch=$2
local arch=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-r" || $1 == "-runtime" ]]; then
local runtime=$2
local runtime=$(__dnvm_to_lower "$2")
shift
elif [[ $1 == "-OS" ]]; then
local os=$2
local os=$(__dnvm_to_lower "$2")
shift
fi
shift