Skip to content

Commit

Permalink
Modernize RID detection in buildvars-setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Sep 21, 2017
1 parent 2394767 commit 834a07d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions buildscripts/buildvars-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,27 @@ check_native_prereqs()
hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }
}

get_current_linux_rid() {
# Construct RID for current distro

get_current_linux_distro() {
# Detect Distro
if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
if [ "$(cat /etc/*-release | grep -cim1 16.04)" -eq 1 ]; then
echo "ubuntu.16.04"
return 0
rid=dotnet-dev-linux-x64

This comment has been minimized.

Copy link
@jkotas

jkotas Sep 21, 2017

rid != name of the dotnet CLI development package

This should be rid=linux-x64.

For extra points, make the arch to be not hardcoded as well - something like this: https://github.com/dotnet/coreclr/blob/master/build-packages.sh#L106

This comment has been minimized.

Copy link
@am11

am11 Sep 21, 2017

Author Owner

Thanks! I have fixed in dotnet#4588.


if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
rid=dev-alpine.$VERSION_ID-x64
fi

echo "ubuntu.14.04"
return 0
elif [ -e /etc/redhat-release ]; then
redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
rid=dotnet-dev-rhel.6-x64
fi
fi

# Cannot determine Linux distribution, assuming Ubuntu 14.04.
echo "ubuntu.14.04"
echo $rid
return 0
}

Expand Down Expand Up @@ -134,7 +140,7 @@ case $OSName in

Linux)
export __BuildOS=Linux
export __NugetRuntimeId=$(get_current_linux_distro)-x64
export __NugetRuntimeId=$(get_current_linux_rid)
;;

NetBSD)
Expand Down

0 comments on commit 834a07d

Please sign in to comment.