]> granicus.if.org Git - sudo/commitdiff
Restore the dot removal in the os version reported by polypkg.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jul 2010 02:19:13 +0000 (22:19 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jul 2010 02:19:13 +0000 (22:19 -0400)
Adapt mkpkg and sudo.pp to the change.

mkpkg
pp
sudo.pp

diff --git a/mkpkg b/mkpkg
index 1b83520279e9eaa9079141259e64df2e98c0bfdf..0a16694ac88ed3a8651ddad24b045cce647ef5ae 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -12,6 +12,7 @@ IFS="         $nl"
 top_srcdir=`dirname $0`
 
 platform=`$top_srcdir/pp --probe` || exit 1
+osrelease=`echo "$platform" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
 
 # Default paths
 prefix=/usr/local
@@ -32,15 +33,11 @@ esac
 case "$platform" in
     centos*|rhel*)
        prefix=/usr
-       case "$platform" in
-           centos[0-4].*|rhel[0-4].*)
-               ;;
-           *)
-               # RHEL 5 and up build pies and have audit support
-               export CFLAGS="$F_PIE" LDFLAGS="-pie"
-               configure_opts="--with-linux-audit"
-               ;;
-       esac
+       if [ $osrelease -ge 50 ]; then
+           # RHEL 5 and up build pies and have audit support
+           export CFLAGS="$F_PIE" LDFLAGS="-pie"
+           configure_opts="--with-linux-audit"
+       fi
        # Note, must indent with tabs, not spaces due to IFS trickery
        configure_opts="$configure_opts
                --prefix=$prefix
@@ -59,19 +56,14 @@ case "$platform" in
        ;;
     sles*)
        prefix=/usr
-       case "$platform" in
-           sles[0-9].*)
-               ;;
-           sles10.*)
-               # SLES 10 and higher build pies
-               export CFLAGS="$F_PIE" LDFLAGS="-pie"
-               ;;
-           *)
-               # SLES 11 and higher has SELinux too
-               export CFLAGS="$F_PIE" LDFLAGS="-pie"
+       if [ $osrelease -ge 10 ]; then
+           # SLES 10 and higher build pies
+           export CFLAGS="$F_PIE" LDFLAGS="-pie"
+           if [ $osrelease -ge 11 ]; then
+               # SLES 11 and higher has SELinux
                configure_opts="--with-selinux"
-               ;;
-       esac
+           fi
+       fi
        # SuSE doesn't have /usr/libexec
        case "$platform" in
            *64*)       libexec=lib64;;
diff --git a/pp b/pp
index 223ddb6bd24cdeaee81940bd2c3682053354166e..ae43a5fe104c0740e5bc1eacd015f16772629022 100755 (executable)
--- a/pp
+++ b/pp
@@ -3762,7 +3762,6 @@ pp_deb_make_data() {
     done 
 
     # If no copyright file is present add one. This is a debian requirement.
-    # XXX - include the LICENSE file instead?
     share_doc="/usr/share/doc/`pp_deb_cmp_full_name $cmp`"
     if [ ! -f "$data/$share_doc/copyright" ]
     then
@@ -3957,8 +3956,7 @@ pp_backend_deb_probe() {
            ;;
        *)
            # Remove trailing revision number and any dots
-           #release=`echo $release | cut -dr -f1 | tr -d .`
-            release=`echo $release | cut -dr -f1`
+            release=`echo $release | cut -dr -f1 | tr -d .`
            ;;
     esac
 
@@ -5036,7 +5034,7 @@ pp_rpm_detect_distro () {
           /^SuSE SLES-[0-9]/  { print "sles" substr($2,6); exit; }
        ' /etc/SuSE-release`
     fi
-    #pp_rpm_distro=`echo $pp_rpm_distro | tr -d .`
+    pp_rpm_distro=`echo $pp_rpm_distro | tr -d .`
     test -z "$pp_rpm_distro" &&
        pp_warn "unknown distro"
 }
diff --git a/sudo.pp b/sudo.pp
index d30dcdf0a218d87da28467fe2f327236df5e4e5b..6b26387da7af645b58f5b132c9cb5f625cbad79c 100644 (file)
--- a/sudo.pp
+++ b/sudo.pp
@@ -22,18 +22,13 @@ still allow people to get their work done."
 
 %set [rpm]
        # Add distro info to release
+       osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
        case "$pp_rpm_distro" in
        centos*|rhel*)
-               d=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/[^0-9].*$//'`
-               if test -n "$d"; then
-                   pp_rpm_release="$pp_rpm_release.el$d"
-               fi
+               pp_rpm_release="$pp_rpm_release.el${osrelease%%[0-9]}"
                ;;
        sles*)
-               d=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/[^0-9].*$//'`
-               if test -n "$d"; then
-                   pp_rpm_release="$pp_rpm_release.sles$d"
-               fi
+               pp_rpm_release="$pp_rpm_release.sles$osrelease"
                ;;
        esac
 
@@ -72,53 +67,53 @@ still allow people to get their work done."
 
        # Choose the correct PAM file by distro, must be tab indented for "<<-"
        case "$pp_rpm_distro" in
-       centos[0-4].*|rhel[0-4].*)
-               mkdir -p ${pp_destdir}/etc/pam.d
-               cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
-               #%PAM-1.0
-               auth       required     pam_stack.so service=system-auth
-               account    required     pam_stack.so service=system-auth
-               password   required     pam_stack.so service=system-auth
-               session    required     pam_limits.so
-               EOF
-               ;;
        centos*|rhel*)
                mkdir -p ${pp_destdir}/etc/pam.d
-               cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
-               #%PAM-1.0
-               auth       include      system-auth
-               account    include      system-auth
-               password   include      system-auth
-               session    optional     pam_keyinit.so revoke
-               session    required     pam_limits.so
-               EOF
-               cat > ${pp_destdir}/etc/pam.d/sudo-i <<-EOF
-               #%PAM-1.0
-               auth       include      sudo
-               account    include      sudo
-               password   include      sudo
-               session    optional     pam_keyinit.so force revoke
-               session    required     pam_limits.so
-               EOF
-               ;;
-         sles9.*)
-               mkdir -p ${pp_destdir}/etc/pam.d
-               cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
-               #%PAM-1.0
-               auth     required       pam_unix2.so
-               session  required       pam_limits.so
-               EOF
+               if test $osrelease -lt 50; then
+                       cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
+                       #%PAM-1.0
+                       auth       required     pam_stack.so service=system-auth
+                       account    required     pam_stack.so service=system-auth
+                       password   required     pam_stack.so service=system-auth
+                       session    required     pam_limits.so
+                       EOF
+               else
+                       cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
+                       #%PAM-1.0
+                       auth       include      system-auth
+                       account    include      system-auth
+                       password   include      system-auth
+                       session    optional     pam_keyinit.so revoke
+                       session    required     pam_limits.so
+                       EOF
+                       cat > ${pp_destdir}/etc/pam.d/sudo-i <<-EOF
+                       #%PAM-1.0
+                       auth       include      sudo
+                       account    include      sudo
+                       password   include      sudo
+                       session    optional     pam_keyinit.so force revoke
+                       session    required     pam_limits.so
+                       EOF
+               fi
                ;;
          sles*)
                mkdir -p ${pp_destdir}/etc/pam.d
-               cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
-               #%PAM-1.0
-               auth     include        common-auth
-               account  include        common-account
-               password include        common-password
-               session  include        common-session
-               # session  optional     pam_xauth.so
-               EOF
+               if test $osrelease -lt 10; then
+                       cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
+                       #%PAM-1.0
+                       auth     required       pam_unix2.so
+                       session  required       pam_limits.so
+                       EOF
+               else
+                       cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
+                       #%PAM-1.0
+                       auth     include        common-auth
+                       account  include        common-account
+                       password include        common-password
+                       session  include        common-session
+                       # session  optional     pam_xauth.so
+                       EOF
+               fi
                ;;
        esac