Skip to content

Commit

Permalink
distr_info: add RockyLinux support
Browse files Browse the repository at this point in the history
  • Loading branch information
vitlav committed Aug 21, 2024
1 parent 3bac416 commit 315d926
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bin/distr_info
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ normalize_version3()
echo "$1" | sed -e "s|^\([^.][^.]*\.[^.][^.]*\.[^.][^.]*\)\..*|\1|"
}

is_numeric()
{
echo "$1" | grep -q "^[0-9][0-9]*$"
}


fill_distr_info()
{
Expand Down Expand Up @@ -394,11 +399,17 @@ if distro os-release ; then
#PRETTY_NAME
VENDOR_ID="$ID"
case "$VENDOR_ID" in
ubuntu|reld|rhel|astra|manjaro|redos|msvsphere|alteros)
ubuntu|reld|rhel|astra|manjaro|redos|msvsphere|alteros|rockylinux|almalinux)
;;
*)
# ID_LIKE can be 'rhel centos fedora', use latest word
[ -n "$ID_LIKE" ] && VENDOR_ID="$(echo "$ID_LIKE" | xargs -n1 | tail -n1)"
if [ -n "$ID_LIKE" ] ; then
# ID_LIKE can be 'rhel centos fedora', use first word
VENDOR_ID="$(echo "$ID_LIKE" | xargs -n1 | head -n1)"
# use latest word for versions like Fedora has
if is_numeric "$DISTRIB_RELEASE" && [ "$DISTRIB_RELEASE" -ge 20 ] ; then
VENDOR_ID="$(echo "$ID_LIKE" | xargs -n1 | tail -n1)"
fi
fi
;;
esac
DISTRIB_FULL_RELEASE="$DISTRIB_RELEASE"
Expand Down
17 changes: 17 additions & 0 deletions tests/etc/RockyLinux/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.4"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.4"

0 comments on commit 315d926

Please sign in to comment.