sync install script params with PowerShell a bit
This commit is contained in:
parent
0e8d52ee7f
commit
7ecb46fa55
1 changed files with 53 additions and 30 deletions
|
@ -54,15 +54,6 @@ exec "$MY_TARGET" "$@"
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
[ -z "$CHANNEL" ] && CHANNEL="dev"
|
|
||||||
|
|
||||||
#set default prefix (PREFIX is a fairly standard env-var, but we also want to allow the use the specific "DOTNET_INSTALL_DIR" one)
|
|
||||||
if [ ! -z "$DOTNET_INSTALL_DIR" ]; then
|
|
||||||
PREFIX=$DOTNET_INSTALL_DIR
|
|
||||||
elif [ -z "$PREFIX" ]; then
|
|
||||||
PREFIX=/usr/local
|
|
||||||
fi
|
|
||||||
|
|
||||||
#setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors.
|
#setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors.
|
||||||
#See if stdout is a terminal
|
#See if stdout is a terminal
|
||||||
if [ -t 1 ]; then
|
if [ -t 1 ]; then
|
||||||
|
@ -158,7 +149,7 @@ install_dotnet()
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
say "Preparing to install .NET Tools to $PREFIX"
|
say "Preparing to install .NET Tools from '$CHANNEL' channel to '$PREFIX'"
|
||||||
|
|
||||||
if [ -e "$PREFIX/share/dotnet/cli/dotnet" ] && [ ! -w "$PREFIX/share/dotnet/cli/dotnet" ]; then
|
if [ -e "$PREFIX/share/dotnet/cli/dotnet" ] && [ ! -w "$PREFIX/share/dotnet/cli/dotnet" ]; then
|
||||||
say_err "dotnet cli is already installed and not writeable. Use 'curl -sSL <url> | sudo sh' to force install."
|
say_err "dotnet cli is already installed and not writeable. Use 'curl -sSL <url> | sudo sh' to force install."
|
||||||
|
@ -243,27 +234,59 @@ FORCE=0
|
||||||
RELINK=0
|
RELINK=0
|
||||||
while [ $# -ne 0 ]
|
while [ $# -ne 0 ]
|
||||||
do
|
do
|
||||||
if [ $1 = "-f" ] || [ $1 = "--force" ]; then
|
name=$1
|
||||||
FORCE=1
|
case $name in
|
||||||
elif [ $1 = "-r" ] || [ $1 = "--relink" ]; then
|
-f|--force)
|
||||||
RELINK=1
|
FORCE=1
|
||||||
elif [ $1 = "-?" ] || [ $1 = "-h" ] || [ $1 = "--help" ]; then
|
;;
|
||||||
echo ".NET Tools Installer"
|
-r|--relink)
|
||||||
echo ""
|
RELINK=1
|
||||||
echo "Usage:"
|
;;
|
||||||
echo " $0 [-f]"
|
-c|--channel)
|
||||||
echo " $0 -r"
|
shift
|
||||||
echo " $0 -h"
|
CHANNEL=$1
|
||||||
echo ""
|
;;
|
||||||
echo "Options:"
|
-d|--destination)
|
||||||
echo " -f Force reinstallation even if you have the most recent version installed"
|
shift
|
||||||
echo " -r Don't re-download, just recreate the links in $PREFIX/bin"
|
DOTNET_INSTALL_DIR=$1
|
||||||
echo " -h Show this help message"
|
;;
|
||||||
echo ""
|
-?|-h|--help)
|
||||||
echo "The PREFIX environment variable can be used to affect the root installation directory"
|
echo ".NET Tools Installer"
|
||||||
exit 0
|
echo ""
|
||||||
fi
|
echo "Usage:"
|
||||||
|
echo " $0 [-f|--force] [-r|--relink] [-c|--channel <CHANNEL>] [-d|--destination <DESTINATION>]"
|
||||||
|
echo " $0 -h|-?|--help"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -f,--force Force reinstallation even if you have the most recent version installed"
|
||||||
|
echo " -r,--relink Don't re-download, just recreate the links in $PREFIX/bin"
|
||||||
|
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified (default: dev)"
|
||||||
|
echo " -d,--destination <PATH> Install under the specified root (see Install Location below)"
|
||||||
|
echo " -?,-h,--help Show this help message"
|
||||||
|
echo ""
|
||||||
|
echo "Install Location:"
|
||||||
|
echo " By default, this script installs the .NET Tools to /usr/local. However, if the PREFIX environment variable"
|
||||||
|
echo " is specified, that will be used as the installation root. If the DOTNET_INSTALL_DIR environment variable"
|
||||||
|
echo " is specified, it will be used as the installation root (overriding PREFIX). Finally, if the '--destination'"
|
||||||
|
echo " option is specified, it will override all environment variables and be used as the installation location"
|
||||||
|
echo ""
|
||||||
|
echo " After installation, the .NET Tools will be installed to the 'share/dotnet/cli' subdirectory of the "
|
||||||
|
echo " installation location (i.e. /usr/local/share/dotnet/cli). Binaries will be symlinked to the 'bin'"
|
||||||
|
echo " subdirectory of the installation location (i.e. /usr/local/bin/dotnet)"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#set default prefix (PREFIX is a fairly standard env-var, but we also want to allow the use the specific "DOTNET_INSTALL_DIR" one)
|
||||||
|
if [ ! -z "$DOTNET_INSTALL_DIR" ]; then
|
||||||
|
PREFIX=$DOTNET_INSTALL_DIR
|
||||||
|
elif [ -z "$PREFIX" ]; then
|
||||||
|
PREFIX=/usr/local
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$CHANNEL" ] && CHANNEL="dev"
|
||||||
|
|
||||||
install_dotnet
|
install_dotnet
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue