2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-28 21:07:55 +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`
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].*)
;;
*)
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"
;;
esac
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.*)
if [ $osrelease -ge 10 ]; then
# 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 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;;

6
pp
View File

@ -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"
}

27
sudo.pp
View File

@ -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,8 +67,9 @@ 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].*)
centos*|rhel*)
mkdir -p ${pp_destdir}/etc/pam.d
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
@ -81,9 +77,7 @@ still allow people to get their work done."
password required pam_stack.so service=system-auth
session required pam_limits.so
EOF
;;
centos*|rhel*)
mkdir -p ${pp_destdir}/etc/pam.d
else
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0
auth include system-auth
@ -100,17 +94,17 @@ still allow people to get their work done."
session optional pam_keyinit.so force revoke
session required pam_limits.so
EOF
fi
;;
sles9.*)
sles*)
mkdir -p ${pp_destdir}/etc/pam.d
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
;;
sles*)
mkdir -p ${pp_destdir}/etc/pam.d
else
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
#%PAM-1.0
auth include common-auth
@ -119,6 +113,7 @@ still allow people to get their work done."
session include common-session
# session optional pam_xauth.so
EOF
fi
;;
esac