update dotnet-install script and use beta channel
This commit is contained in:
parent
c0ed67e96f
commit
95be6b9a51
|
|
@ -9,6 +9,9 @@ IF "%NUGET_PATH%"=="" (
|
|||
ECHO Error: NUGET_PATH is not set.
|
||||
EXIT /B 1
|
||||
)
|
||||
IF "%KOREBUILD_DOTNET_CHANNEL%"=="" (
|
||||
SET KOREBUILD_DOTNET_CHANNEL=beta
|
||||
)
|
||||
|
||||
IF NOT EXIST Sake (
|
||||
"%NUGET_PATH%" install Sake -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||
|
|
@ -30,7 +33,7 @@ IF "%KOREBUILD_SKIP_RUNTIME_INSTALL%"=="1" (
|
|||
SET DOTNET_LOCAL_INSTALL_FOLDER=%LOCALAPPDATA%\Microsoft\dotnet\cli
|
||||
SET DOTNET_LOCAL_INSTALL_FOLDER_BIN=%DOTNET_LOCAL_INSTALL_FOLDER%\bin
|
||||
|
||||
CALL %~dp0dotnet-install.cmd
|
||||
CALL %~dp0dotnet-install.cmd -Channel %KOREBUILD_DOTNET_CHANNEL%
|
||||
|
||||
ECHO Adding %DOTNET_LOCAL_INSTALL_FOLDER_BIN% to PATH
|
||||
SET PATH=%DOTNET_LOCAL_INSTALL_FOLDER_BIN%;%PATH%
|
||||
|
|
@ -59,4 +62,4 @@ ECHO Using makefile: %MAKEFILE_PATH%
|
|||
|
||||
|
||||
REM Don't use full paths. Sake doesn't support them!
|
||||
"%~dp0Sake\tools\Sake.exe" -I %KOREBUILD_FOLDER%\build -f %MAKEFILE_PATH% %*
|
||||
"%~dp0Sake\tools\Sake.exe" -I %KOREBUILD_FOLDER%\build -f %MAKEFILE_PATH% %*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
[ -z "$KOREBUILD_DOTNET_CHANNEL" ] && KOREBUILD_DOTNET_CHANNEL=beta
|
||||
|
||||
targets=""
|
||||
filename=$0
|
||||
while [[ $# > 0 ]]; do
|
||||
|
|
@ -57,7 +60,7 @@ else
|
|||
export DOTNET_HOME=$DOTNET_INSTALL_DIR/share/dotnet/cli
|
||||
export KOREBUILD_FOLDER="$(dirname $thisDir)"
|
||||
chmod +x $thisDir/dotnet-install.sh
|
||||
$thisDir/dotnet-install.sh
|
||||
$thisDir/dotnet-install.sh --channel $KOREBUILD_DOTNET_CHANNEL
|
||||
# ==== Temporary ====
|
||||
if ! type dnvm > /dev/null 2>&1; then
|
||||
source $thisDir/dnvm.sh
|
||||
|
|
|
|||
|
|
@ -3,38 +3,21 @@
|
|||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
param (
|
||||
[string] $InstallDir = $null,
|
||||
[string] $TargetPlatform = "x64",
|
||||
[string] $Version = "Latest"
|
||||
)
|
||||
param([string]$Channel="dev")
|
||||
|
||||
|
||||
$ErrorActionPreference="Stop"
|
||||
$ProgressPreference="SilentlyContinue"
|
||||
|
||||
$Feed="https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
$Channel="dev"
|
||||
$fileVersion = $Version
|
||||
if ($fileVersion -eq "Latest") {
|
||||
$fileVersion = "latest"
|
||||
}
|
||||
|
||||
$DotNetFileName="dotnet-win-${TargetPlatform}.$fileVersion.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/$Version"
|
||||
|
||||
|
||||
Write-Host $DotNetFileName
|
||||
$DotNetFileName="dotnet-win-x64.latest.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/Latest"
|
||||
|
||||
function say($str)
|
||||
{
|
||||
Write-Host "dotnet_install: $str"
|
||||
}
|
||||
|
||||
|
||||
if (!$InstallDir) {
|
||||
$InstallDir = "$env:LocalAppData\Microsoft\dotnet"
|
||||
}
|
||||
|
||||
$InstallDir = $env:DOTNET_INSTALL_DIR
|
||||
if (!$InstallDir) {
|
||||
$InstallDir = "$env:LocalAppData\Microsoft\dotnet"
|
||||
|
|
@ -44,36 +27,28 @@ say "Preparing to install .NET Tools to $InstallDir"
|
|||
|
||||
# Check if we need to bother
|
||||
$LocalFile = "$InstallDir\cli\.version"
|
||||
if ((Test-Path $LocalFile))
|
||||
if (Test-Path $LocalFile)
|
||||
{
|
||||
$LocalData = @(cat $LocalFile)
|
||||
$LocalHash = $LocalData[0].Trim()
|
||||
$LocalVersion = $LocalData[1].Trim()
|
||||
if ($LocalVersion -and $LocalHash)
|
||||
{
|
||||
if ($Version -eq "Latest")
|
||||
{
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
{
|
||||
say "You already have the latest version"
|
||||
exit 0
|
||||
}
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
elseif ($LocalVersion -eq $Version)
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
{
|
||||
say "You already have the local version"
|
||||
say "You already have the latest version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
|
@ -115,4 +90,4 @@ if (Test-Path "$InstallDir\$DotNetFileName") {
|
|||
say "The .NET Tools have been installed to $InstallDir\cli!"
|
||||
|
||||
# New layout
|
||||
say "Add '$InstallDir\cli\bin' to your PATH to use dotnet"
|
||||
say "Add '$InstallDir\cli\bin' to your PATH to use dotnet"
|
||||
|
|
|
|||
|
|
@ -54,13 +54,6 @@ exec "$MY_TARGET" "$@"
|
|||
EOF
|
||||
)
|
||||
|
||||
#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.
|
||||
#See if stdout is a terminal
|
||||
if [ -t 1 ]; then
|
||||
|
|
@ -156,7 +149,7 @@ install_dotnet()
|
|||
return 1
|
||||
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
|
||||
say_err "dotnet cli is already installed and not writeable. Use 'curl -sSL <url> | sudo sh' to force install."
|
||||
|
|
@ -171,13 +164,13 @@ install_dotnet()
|
|||
fi
|
||||
local os=$(current_os)
|
||||
local installLocation="$PREFIX/share/dotnet"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/Binaries/Latest"
|
||||
local dotnet_filename="dotnet-$os-x64.latest.tar.gz"
|
||||
|
||||
if [ "$RELINK" = "0" ]; then
|
||||
if [ "$FORCE" = "0" ]; then
|
||||
# Check if we need to bother
|
||||
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/dev/dnvm/latest.$os.version)"
|
||||
local remoteData="$(curl -s https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/dnvm/latest.$os.version)"
|
||||
[ $? != 0 ] && say_err "Unable to determine latest version." && return 1
|
||||
|
||||
local remoteVersion=$(IFS="\n" && echo $remoteData | tail -n 1)
|
||||
|
|
@ -241,27 +234,59 @@ FORCE=0
|
|||
RELINK=0
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
if [ $1 = "-f" ] || [ $1 = "--force" ]; then
|
||||
FORCE=1
|
||||
elif [ $1 = "-r" ] || [ $1 = "--relink" ]; then
|
||||
RELINK=1
|
||||
elif [ $1 = "-?" ] || [ $1 = "-h" ] || [ $1 = "--help" ]; then
|
||||
echo ".NET Tools Installer"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 [-f]"
|
||||
echo " $0 -r"
|
||||
echo " $0 -h"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -f Force reinstallation even if you have the most recent version installed"
|
||||
echo " -r Don't re-download, just recreate the links in $PREFIX/bin"
|
||||
echo " -h Show this help message"
|
||||
echo ""
|
||||
echo "The PREFIX environment variable can be used to affect the root installation directory"
|
||||
exit 0
|
||||
fi
|
||||
name=$1
|
||||
case $name in
|
||||
-f|--force)
|
||||
FORCE=1
|
||||
;;
|
||||
-r|--relink)
|
||||
RELINK=1
|
||||
;;
|
||||
-c|--channel)
|
||||
shift
|
||||
CHANNEL=$1
|
||||
;;
|
||||
-d|--destination)
|
||||
shift
|
||||
DOTNET_INSTALL_DIR=$1
|
||||
;;
|
||||
-?|-h|--help)
|
||||
echo ".NET Tools Installer"
|
||||
echo ""
|
||||
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
|
||||
done
|
||||
|
||||
install_dotnet
|
||||
#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
|
||||
|
|
|
|||
Loading…
Reference in New Issue