Update changes from dotnet/cli to the dotnet-install.ps1/sh scripts

This commit is contained in:
Nate McMaster 2018-01-08 09:10:12 -08:00
Родитель c9349d4c8a
Коммит 8cea8c5831
2 изменённых файлов: 13 добавлений и 14 удалений

7
files/KoreBuild/scripts/dotnet-install.ps1 поставляемый
Просмотреть файл

@ -220,10 +220,9 @@ function GetHTTPResponse([Uri] $Uri)
# Default timeout for HttpClient is 100s. For a 50 MB download this assumes 500 KB/s average, any less will time out
# 10 minutes allows it to work over much slower connections.
$HttpClient.Timeout = New-TimeSpan -Minutes 10
$ActualUri = if (($Uri -like "$AzureFeed*") -or ($Uri -like "$UncachedFeed*")) { "${Uri}${FeedCredential}" } else { $Uri }
$Response = $HttpClient.GetAsync($ActualUri).Result
$Response = $HttpClient.GetAsync("${Uri}${FeedCredential}").Result
if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode))) {
# The feed credential is potential sensitive info. Do not log ActualUri to console output.
# The feed credential is potentially sensitive info. Do not log FeedCredential to console output.
$ErrorMsg = "Failed to download $Uri."
if ($Response -ne $null) {
$ErrorMsg += " $Response"
@ -250,7 +249,7 @@ function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Co
if ($Runtime -eq "dotnet") {
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
}
elseif ($Runtime -eq "aspnetcore") {
elseif ($Runtime) {
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.$Runtime.version"
}
else {

16
files/KoreBuild/scripts/dotnet-install.sh поставляемый
Просмотреть файл

@ -22,7 +22,7 @@ exec 3>&1
# 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
if [ -t 1 ] && command -v tput > /dev/null; then
# see if it supports colors
ncolors=$(tput colors)
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then
@ -124,6 +124,10 @@ get_linux_platform_name() {
else
if [ -e /etc/os-release ]; then
. /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
fi
echo "$ID.$VERSION_ID"
return 0
elif [ -e /etc/redhat-release ]; then
@ -150,8 +154,8 @@ get_current_os_name() {
local linux_platform_name
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
if [[ $linux_platform_name == "rhel.6"* ]]; then
echo "rhel.6"
if [[ $linux_platform_name == "rhel.6" || $linux_platform_name == "alpine.3.6" ]]; then
echo $linux_platform_name
return 0
else
echo "linux"
@ -627,9 +631,7 @@ downloadcurl() {
local out_path="${2:-}"
# Append feed_credential as late as possible before calling curl to avoid logging feed_credential
if [[ "$remote_path" == "$azure_feed"* ]] || [[ "$remote_path" == "$uncached_feed"* ]]; then
remote_path="${remote_path}${feed_credential}"
fi
local failed=false
if [ -z "$out_path" ]; then
@ -650,15 +652,13 @@ downloadwget() {
local out_path="${2:-}"
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential
if [[ "$remote_path" == "$azure_feed"* ]] || [[ "$remote_path" == "$uncached_feed"* ]]; then
remote_path="${remote_path}${feed_credential}"
fi
local failed=false
if [ -z "$out_path" ]; then
wget -q --tries 10 -O - "$remote_path" || failed=true
else
wget -v --tries 10 -O "$out_path" "$remote_path" || failed=true
wget --tries 10 -O "$out_path" "$remote_path" || failed=true
fi
if [ "$failed" = true ]; then
say_verbose "Wget download failed"