2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-29 05:17:54 +00:00

Restore the dot removal in the os version reported by polypkg.

Adapt mkpkg and sudo.pp to the change.
This commit is contained in:
Todd C. Miller 2010-07-15 22:19:13 -04:00
parent 33c029c8ce
commit 3907d43635
3 changed files with 60 additions and 75 deletions

24
mkpkg
View File

@ -12,6 +12,7 @@ IFS=" $nl"
top_srcdir=`dirname $0` top_srcdir=`dirname $0`
platform=`$top_srcdir/pp --probe` || exit 1 platform=`$top_srcdir/pp --probe` || exit 1
osrelease=`echo "$platform" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
# Default paths # Default paths
prefix=/usr/local prefix=/usr/local
@ -32,15 +33,11 @@ esac
case "$platform" in case "$platform" in
centos*|rhel*) centos*|rhel*)
prefix=/usr prefix=/usr
case "$platform" in if [ $osrelease -ge 50 ]; then
centos[0-4].*|rhel[0-4].*)
;;
*)
# RHEL 5 and up build pies and have audit support # RHEL 5 and up build pies and have audit support
export CFLAGS="$F_PIE" LDFLAGS="-pie" export CFLAGS="$F_PIE" LDFLAGS="-pie"
configure_opts="--with-linux-audit" configure_opts="--with-linux-audit"
;; fi
esac
# Note, must indent with tabs, not spaces due to IFS trickery # Note, must indent with tabs, not spaces due to IFS trickery
configure_opts="$configure_opts configure_opts="$configure_opts
--prefix=$prefix --prefix=$prefix
@ -59,19 +56,14 @@ case "$platform" in
;; ;;
sles*) sles*)
prefix=/usr prefix=/usr
case "$platform" in if [ $osrelease -ge 10 ]; then
sles[0-9].*)
;;
sles10.*)
# SLES 10 and higher build pies # SLES 10 and higher build pies
export CFLAGS="$F_PIE" LDFLAGS="-pie" export CFLAGS="$F_PIE" LDFLAGS="-pie"
;; if [ $osrelease -ge 11 ]; then
*) # SLES 11 and higher has SELinux
# SLES 11 and higher has SELinux too
export CFLAGS="$F_PIE" LDFLAGS="-pie"
configure_opts="--with-selinux" configure_opts="--with-selinux"
;; fi
esac fi
# SuSE doesn't have /usr/libexec # SuSE doesn't have /usr/libexec
case "$platform" in case "$platform" in
*64*) libexec=lib64;; *64*) libexec=lib64;;

6
pp
View File

@ -3762,7 +3762,6 @@ pp_deb_make_data() {
done done
# If no copyright file is present add one. This is a debian requirement. # 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`" share_doc="/usr/share/doc/`pp_deb_cmp_full_name $cmp`"
if [ ! -f "$data/$share_doc/copyright" ] if [ ! -f "$data/$share_doc/copyright" ]
then then
@ -3957,8 +3956,7 @@ pp_backend_deb_probe() {
;; ;;
*) *)
# Remove trailing revision number and any dots # Remove trailing revision number and any dots
#release=`echo $release | cut -dr -f1 | tr -d .` release=`echo $release | cut -dr -f1 | tr -d .`
release=`echo $release | cut -dr -f1`
;; ;;
esac esac
@ -5036,7 +5034,7 @@ pp_rpm_detect_distro () {
/^SuSE SLES-[0-9]/ { print "sles" substr($2,6); exit; } /^SuSE SLES-[0-9]/ { print "sles" substr($2,6); exit; }
' /etc/SuSE-release` ' /etc/SuSE-release`
fi fi
#pp_rpm_distro=`echo $pp_rpm_distro | tr -d .` pp_rpm_distro=`echo $pp_rpm_distro | tr -d .`
test -z "$pp_rpm_distro" && test -z "$pp_rpm_distro" &&
pp_warn "unknown distro" pp_warn "unknown distro"
} }

27
sudo.pp
View File

@ -22,18 +22,13 @@ still allow people to get their work done."
%set [rpm] %set [rpm]
# Add distro info to release # Add distro info to release
osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'`
case "$pp_rpm_distro" in case "$pp_rpm_distro" in
centos*|rhel*) centos*|rhel*)
d=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/[^0-9].*$//'` pp_rpm_release="$pp_rpm_release.el${osrelease%%[0-9]}"
if test -n "$d"; then
pp_rpm_release="$pp_rpm_release.el$d"
fi
;; ;;
sles*) sles*)
d=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*//' -e 's/[^0-9].*$//'` pp_rpm_release="$pp_rpm_release.sles$osrelease"
if test -n "$d"; then
pp_rpm_release="$pp_rpm_release.sles$d"
fi
;; ;;
esac esac
@ -72,8 +67,9 @@ still allow people to get their work done."
# Choose the correct PAM file by distro, must be tab indented for "<<-" # Choose the correct PAM file by distro, must be tab indented for "<<-"
case "$pp_rpm_distro" in case "$pp_rpm_distro" in
centos[0-4].*|rhel[0-4].*) centos*|rhel*)
mkdir -p ${pp_destdir}/etc/pam.d mkdir -p ${pp_destdir}/etc/pam.d
if test $osrelease -lt 50; then
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0 #%PAM-1.0
auth required pam_stack.so service=system-auth auth required pam_stack.so service=system-auth
@ -81,9 +77,7 @@ still allow people to get their work done."
password required pam_stack.so service=system-auth password required pam_stack.so service=system-auth
session required pam_limits.so session required pam_limits.so
EOF EOF
;; else
centos*|rhel*)
mkdir -p ${pp_destdir}/etc/pam.d
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0 #%PAM-1.0
auth include system-auth auth include system-auth
@ -100,17 +94,17 @@ still allow people to get their work done."
session optional pam_keyinit.so force revoke session optional pam_keyinit.so force revoke
session required pam_limits.so session required pam_limits.so
EOF EOF
fi
;; ;;
sles9.*) sles*)
mkdir -p ${pp_destdir}/etc/pam.d mkdir -p ${pp_destdir}/etc/pam.d
if test $osrelease -lt 10; then
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0 #%PAM-1.0
auth required pam_unix2.so auth required pam_unix2.so
session required pam_limits.so session required pam_limits.so
EOF EOF
;; else
sles*)
mkdir -p ${pp_destdir}/etc/pam.d
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0 #%PAM-1.0
auth include common-auth auth include common-auth
@ -119,6 +113,7 @@ still allow people to get their work done."
session include common-session session include common-session
# session optional pam_xauth.so # session optional pam_xauth.so
EOF EOF
fi
;; ;;
esac esac