From 7b3dcdd936d2544683c8ba3988d49fe4bb5ac839 Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Tue, 27 Dec 2022 19:41:12 -0800 Subject: [PATCH] rpm/build_rpms.bsh: drop old OS release parsing Our rpm/build_rpms.bsh script currently attempts to parse the /etc/os-release file to retrieve the major OS version number, and if that file does not exist, reads /etc/redhat-release instead; the latter logic has been in place since the introduction of the script in commit 4a7162777913489e7c70a3da3235dcd3eeec553b of PR #332, and has been the fallback logic since commit 56ffe420b787ba2f738287e07d6af9f177e51b4f of PR #555. However, /etc/os-release should exist on all the current versions of CentOS and Rocky Linux we support, so we do not need to retain the fallback parsing of /etc/redhat-release at this point. --- rpm/build_rpms.bsh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rpm/build_rpms.bsh b/rpm/build_rpms.bsh index 101742c3..4866d2fd 100755 --- a/rpm/build_rpms.bsh +++ b/rpm/build_rpms.bsh @@ -3,15 +3,10 @@ set -eu CURDIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd) -if [ -e /etc/os-release ]; then - VERSION_ID=$(source /etc/os-release; echo ${VERSION_ID%%.*}) - OS_NAME=$(source /etc/os-release; echo ${NAME}) - OS_NAME=${OS_NAME,,} -else #Basically Centos 5/6 - VERSION_ID=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+')) - OS_NAME=$(awk '{print tolower($1)}' /etc/redhat-release) - #Stupid ancient bash 3... -fi + +VERSION_ID=$(source /etc/os-release; echo ${VERSION_ID%%.*}) +OS_NAME=$(source /etc/os-release; echo ${NAME}) +OS_NAME=${OS_NAME,,} case "${OS_NAME}" in centos*|red*|almalinux|rocky*)