Re: Pre-built packages, "mkpkg" and "osversion"/"osrelease" errors

"Todd C. Miller" <[email protected]>
Newsgroups gmane.comp.tools.sudo.user
Message-ID <[email protected]>
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
____________________________________________________________
sudo-users mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.