[sudo-users] Pre-built packages, "mkpkg" and "osversion"/"osrelease" errors

Todd C. Miller Todd.Miller at sudo.ws
Mon Feb 4 20:54:11 MST 2019


On Mon, 04 Feb 2019 16:23:24 -0800, "Greg Earle" wrote:

> Is it possible to find out what OS the pre-made binaries on sudo.ws were 
> built on?  (e.g. "linux-build.sudo.ws")

They are built in a chroot that generally contains a fairly early
OS release.  In the case of RHEL 5, the chroot was built from RHEL
5.9.

> In looking into building our own with "mkpkg", I found a bug.  If the OS 
> minor release is 10 or above (e.g. RHEL 5.10/5.11/6.10), the "osversion" 
> string will be something like "rhel510-i386" and then
>
> osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
>
> down-converts that to just "510", which of course is higher than "60" so 
> "mkpkg" erroneously adds in the options for RHEL 6 (i.e. LDAP and SSS 
> support).

Unfortunately, the value provided by "pp --probe" doesn't contain
the decimal point which makes it unless for determining the major
OS version.

The following diff to mkpkg should work for you.

 - todd

diff -r d42b4c325c0c mkpkg
--- a/mkpkg	Mon Feb 04 14:07:20 2019 -0700
+++ b/mkpkg	Mon Feb 04 20:54:01 2019 -0700
@@ -157,15 +157,16 @@ case "$osversion" in
     centos*|rhel*|f[0-9]*)
 	case "$osversion" in
 	    centos*|rhel*)
-		if [ $osrelease -ge 40 ]; then
+		osmajor=`sed -n -e 's/^.*release \([0-9]*\)[^0-9].*$/\1/p' /etc/redhat-release`
+		if [ $osmajor -ge 4 ]; then
 		    # RHEL 4 and up support SELinux
 		    with_selinux=true
-		    if [ $osrelease -ge 50 ]; then
+		    if [ $osmajor -ge 5 ]; then
 			# RHEL 5 and up has audit support and uses a
 			# separate PAM config file for "sudo -i".
 			with_linux_audit=true
 			with_pam_login=true
-			if [ $osrelease -ge 60 ]; then
+			if [ $osmajor -ge 6 ]; then
 			    # RHEL 6 and above builds sudo with SSSD support
 			    with_sssd=true
 			    # RHEL 6 and above use /etc/sudo-ldap.conf


More information about the sudo-users mailing list