diff --git a/eng/common/native/init-distro-rid.sh b/eng/common/native/init-distro-rid.sh index 5dcbfd700f0362..228be0b1598629 100644 --- a/eng/common/native/init-distro-rid.sh +++ b/eng/common/native/init-distro-rid.sh @@ -20,7 +20,7 @@ getNonPortableDistroRid() # shellcheck disable=SC1091 if [ -e "${rootfsDir}/etc/os-release" ]; then . "${rootfsDir}/etc/os-release" - if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "alpine" ]; then + if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "alpine" ] || [ "${ID}" = "ol" ]; then VERSION_ID="${VERSION_ID%.*}" # Remove the last version digit for these distros fi diff --git a/src/native/corehost/hostmisc/pal.unix.cpp b/src/native/corehost/hostmisc/pal.unix.cpp index 34520aefd7365a..23afd18bad6c8f 100644 --- a/src/native/corehost/hostmisc/pal.unix.cpp +++ b/src/native/corehost/hostmisc/pal.unix.cpp @@ -767,6 +767,7 @@ pal::string_t normalize_linux_rid(pal::string_t rid) pal::string_t rhelPrefix(_X("rhel.")); pal::string_t alpinePrefix(_X("alpine.")); pal::string_t rockyPrefix(_X("rocky.")); + pal::string_t olPrefix(_X("ol.")); size_t lastVersionSeparatorIndex = std::string::npos; if (rid.compare(0, rhelPrefix.length(), rhelPrefix) == 0) @@ -785,6 +786,10 @@ pal::string_t normalize_linux_rid(pal::string_t rid) { lastVersionSeparatorIndex = rid.find(_X("."), rockyPrefix.length()); } + else if (rid.compare(0, olPrefix.length(), olPrefix) == 0) + { + lastVersionSeparatorIndex = rid.find(_X("."), olPrefix.length()); + } if (lastVersionSeparatorIndex != std::string::npos) {