From d04805eecb48d3e484481e39332820ed21aabfea Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 24 Jun 2020 14:19:14 -0600 Subject: [PATCH] Fix parsing of /etc/redhat-release on RHEL 8. RedHat dropped the word "server" from the release name in redhat-release which results in the awk script printing the wrong field. Instead of using awk, just use sed to pull out the version number immediately following the word "release". --- scripts/pp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/pp b/scripts/pp index c55d0f2db..2fece7068 100755 --- a/scripts/pp +++ b/scripts/pp @@ -1,6 +1,6 @@ #!/bin/sh # Copyright 2020 One Identity LLC. ALL RIGHTS RESERVED -pp_revision="20200506" +pp_revision="20200624" # Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED. # # Redistribution and use in source and binary forms, with or without @@ -5562,12 +5562,11 @@ pp_rpm_detect_distro () { /^Fedora release/ { print "f" $3; exit; } ' /etc/fedora-release` elif test -f /etc/redhat-release; then - pp_rpm_distro=`awk ' - /^Red Hat Enterprise Linux/ { print "rhel" $7; exit; } - /^CentOS release/ { print "centos" $3; exit; } - /^CentOS Linux release/ { print "centos" $4; exit; } - /^Red Hat Linux release/ { print "rh" $5; exit; } - ' /etc/redhat-release` + pp_rpm_distro=`sed -n \ + -e 's/^Red Hat Linux.*release \([0-9][0-9\.]*\).*/rh\1/p' \ + -e 's/^Red Hat Enterprise Linux.*release \([0-9][0-9\.]*\).*/rhel\1/p' \ + -e 's/^CentOS.*release \([0-9][0-9\.]*\).*/centos\1/p' \ + /etc/redhat-release` elif test -f /etc/SuSE-release; then pp_rpm_distro=`awk ' /^SuSE Linux [0-9]/ { print "suse" $3; exit; }