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.
This commit is contained in:
Chris Darroch 2022-12-27 19:41:12 -08:00
parent 4140f638e9
commit 7b3dcdd936

@ -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
case "${OS_NAME}" in
centos*|red*|almalinux|rocky*)