Enable RHEL6 and CentOS 6 RID detection in build (#13101)
authorJan Vorlicek <janvorli@microsoft.com>
Mon, 31 Jul 2017 09:51:13 +0000 (11:51 +0200)
committerGitHub <noreply@github.com>
Mon, 31 Jul 2017 09:51:13 +0000 (11:51 +0200)
This change adds RHEL6 and CentOS 6 RID detection to build.sh.
These distros don't have the /etc/os-release file and so
we need to use another source - the /etc/redhat-release file

build.sh

index 91a97e4..b619592 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -60,15 +60,22 @@ usage()
 
 initHostDistroRid()
 {
+    __HostDistroRid=""
     if [ "$__HostOS" == "Linux" ]; then
-        if [ ! -e /etc/os-release ]; then
-            echo "WARNING: Can not determine runtime id for current distro."
-            __HostDistroRid=""
-        else
+        if [ -e /etc/os-release ]; then
             source /etc/os-release
             __HostDistroRid="$ID.$VERSION_ID-$__HostArch"
+        elif [ -e /etc/redhat-release ]; then
+            local redhatRelease=$(</etc/redhat-release)
+            if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
+               __HostDistroRid="rhel.6-$__HostArch"
+            fi
         fi
     fi
+
+    if [ "$__HostDistroRid" == "" ]; then
+        echo "WARNING: Can not determine runtime id for current distro."
+    fi
 }
 
 initTargetDistroRid()
@@ -391,7 +398,7 @@ isMSBuildOnNETCoreSupported()
         if [ "$__HostOS" == "Linux" ]; then
             __isMSBuildOnNETCoreSupported=1
             # note: the RIDs below can use globbing patterns
-            UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64" "alpine.3.6.*-x64")
+            UNSUPPORTED_RIDS=("debian.9-x64" "ubuntu.17.04-x64" "alpine.3.6.*-x64" "rhel.6-x64" "")
             for UNSUPPORTED_RID in "${UNSUPPORTED_RIDS[@]}"
             do
                 if [[ $__HostDistroRid == $UNSUPPORTED_RID ]]; then