2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

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".
This commit is contained in:
Todd C. Miller 2020-06-24 14:19:14 -06:00
parent 820d6ae207
commit d04805eecb

View File

@ -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; }