2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-29 13:28:10 +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 #!/bin/sh
# Copyright 2020 One Identity LLC. ALL RIGHTS RESERVED # Copyright 2020 One Identity LLC. ALL RIGHTS RESERVED
pp_revision="20200506" pp_revision="20200624"
# Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED. # Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED.
# #
# Redistribution and use in source and binary forms, with or without # 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; } /^Fedora release/ { print "f" $3; exit; }
' /etc/fedora-release` ' /etc/fedora-release`
elif test -f /etc/redhat-release; then elif test -f /etc/redhat-release; then
pp_rpm_distro=`awk ' pp_rpm_distro=`sed -n \
/^Red Hat Enterprise Linux/ { print "rhel" $7; exit; } -e 's/^Red Hat Linux.*release \([0-9][0-9\.]*\).*/rh\1/p' \
/^CentOS release/ { print "centos" $3; exit; } -e 's/^Red Hat Enterprise Linux.*release \([0-9][0-9\.]*\).*/rhel\1/p' \
/^CentOS Linux release/ { print "centos" $4; exit; } -e 's/^CentOS.*release \([0-9][0-9\.]*\).*/centos\1/p' \
/^Red Hat Linux release/ { print "rh" $5; exit; } /etc/redhat-release`
' /etc/redhat-release`
elif test -f /etc/SuSE-release; then elif test -f /etc/SuSE-release; then
pp_rpm_distro=`awk ' pp_rpm_distro=`awk '
/^SuSE Linux [0-9]/ { print "suse" $3; exit; } /^SuSE Linux [0-9]/ { print "suse" $3; exit; }