diff --git a/src/corehost/common/pal.unix.cpp b/src/corehost/common/pal.unix.cpp index 1d4ed27cbe..9aeccf6d23 100644 --- a/src/corehost/common/pal.unix.cpp +++ b/src/corehost/common/pal.unix.cpp @@ -274,6 +274,7 @@ pal::string_t pal::get_current_os_rid_platform() { pal::string_t ridOS; pal::string_t versionFile(_X("/etc/os-release")); + pal::string_t rhelVersionFile(_X("/etc/redhat-release")); if (pal::file_exists(versionFile)) { @@ -353,6 +354,35 @@ pal::string_t pal::get_current_os_rid_platform() } } } + else if (pal::file_exists(rhelVersionFile)) + { + // Read the file to check if the current OS is RHEL or CentOS 6.x + std::fstream fsVersionFile; + + fsVersionFile.open(rhelVersionFile, std::fstream::in); + + // Proceed only if we were able to open the file + if (fsVersionFile.good()) + { + pal::string_t line; + // Read the first line + std::getline(fsVersionFile, line); + + if (!fsVersionFile.eof()) + { + pal::string_t rhel6Prefix(_X("Red Hat Enterprise Linux Server release 6.")); + pal::string_t centos6Prefix(_X("CentOS release 6.")); + + if ((line.find(rhel6Prefix) == 0) || (line.find(centos6Prefix) == 0)) + { + ridOS = _X("rhel.6"); + } + } + + // Close the file now that we are done with it. + fsVersionFile.close(); + } + } return normalize_linux_rid(ridOS); } diff --git a/src/managed/CommonManaged.props b/src/managed/CommonManaged.props index f1e54e58e4..0c54133e58 100644 --- a/src/managed/CommonManaged.props +++ b/src/managed/CommonManaged.props @@ -5,7 +5,7 @@ $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../..'))/ - 2.0.1 + 2.0.2 $(VersionPrefix) true true diff --git a/src/managed/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs b/src/managed/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs index ab16ce363a..936b0b4fbe 100644 --- a/src/managed/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs +++ b/src/managed/Microsoft.DotNet.PlatformAbstractions/Native/PlatformApis.cs @@ -85,6 +85,8 @@ private static string GetDistroVersionId() private static DistroInfo LoadDistroInfo() { + DistroInfo result = null; + // Sample os-release file: // NAME="Ubuntu" // VERSION = "14.04.3 LTS, Trusty Tahr" @@ -100,7 +102,7 @@ private static DistroInfo LoadDistroInfo() if (File.Exists("/etc/os-release")) { var lines = File.ReadAllLines("/etc/os-release"); - var result = new DistroInfo(); + result = new DistroInfo(); foreach (var line in lines) { if (line.StartsWith("ID=", StringComparison.Ordinal)) @@ -112,10 +114,30 @@ private static DistroInfo LoadDistroInfo() result.VersionId = line.Substring(11).Trim('"', '\''); } } + } + else if (File.Exists("/etc/redhat-release")) + { + var lines = File.ReadAllLines("/etc/redhat-release"); + + if (lines.Length >= 1) + { + string line = lines[0]; + if (line.StartsWith("Red Hat Enterprise Linux Server release 6.") || + line.StartsWith("CentOS release 6.")) + { + result = new DistroInfo(); + result.Id = "rhel"; + result.VersionId = "6"; + } + } + } - return NormalizeDistroInfo(result); + if (result != null) + { + result = NormalizeDistroInfo(result); } - return null; + + return result; } // For some distros, we don't want to use the full version from VERSION_ID. One example is diff --git a/src/managed/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj b/src/managed/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj index d09c26bdb6..c05bac39e7 100644 --- a/src/managed/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj +++ b/src/managed/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj @@ -8,9 +8,7 @@ - - - + diff --git a/src/pkg/packaging/dir.proj b/src/pkg/packaging/dir.proj index 83ea832e76..9102701c6f 100644 --- a/src/pkg/packaging/dir.proj +++ b/src/pkg/packaging/dir.proj @@ -170,10 +170,15 @@ - + + + + + + --output $(PackagesOutDir)