⬆️ dnvm.ps1, dnvm.cmd, dnvm.sh

Source: aspnet/dnvm@703c1ffdd4
This commit is contained in:
ASP.NET Push Bot 2015-10-20 15:13:13 -07:00 committed by unknown
parent e9bc588e96
commit 3b532d4c3e
2 changed files with 20 additions and 16 deletions

View File

@ -67,7 +67,7 @@ function _WriteOut {
### Constants ### Constants
$ProductVersion="1.0.0" $ProductVersion="1.0.0"
$BuildVersion="rc1-15528" $BuildVersion="rc1-15530"
$Authors="Microsoft Open Technologies, Inc." $Authors="Microsoft Open Technologies, Inc."
# If the Version hasn't been replaced... # If the Version hasn't been replaced...

34
dnvm.sh
View File

@ -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-15528" _DNVM_BUILDNUMBER="rc1-15530"
_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