From 2e6f049cca40b7c6c483c31cf044994cb0c54315 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Tue, 1 Feb 2022 11:52:28 -0500 Subject: [PATCH] build_utils.sh: CentOS 9 Stream support for get_rpm_dist Signed-off-by: David Galloway --- scripts/build_utils.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index a435ecdf..5017e1d6 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -257,9 +257,11 @@ get_rpm_dist() { # use in constructing chacra urls for rpm distros LSB_RELEASE=/usr/bin/lsb_release - [ ! -x $LSB_RELEASE ] && echo unknown && exit - - ID=`$LSB_RELEASE --short --id` + if [ ! -x $LSB_RELEASE ]; then + source /etc/os-release + else + ID=`$LSB_RELEASE --short --id` + fi case $ID in RedHatEnterpriseServer) @@ -267,8 +269,12 @@ get_rpm_dist() { DIST=rhel$RELEASE DISTRO=rhel ;; - CentOS|CentOSStream) - RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1` + CentOS|CentOSStream|centos) + if [ "$VERSION_ID" == "9" ]; then + RELEASE="9" + else + RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1` + fi DIST=el$RELEASE DISTRO=centos ;; @@ -293,6 +299,8 @@ get_rpm_dist() { *) DIST=unknown DISTRO=unknown + echo "Unknown distro. Exiting." + exit 1 ;; esac DISTRO_VERSION=$RELEASE -- 2.39.5