2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-30 13:58:05 +00:00

Fedora dropped "core" from the name some time ago so just match on

f[0-9] for the rpm distro name provided by pp.  Since the version
numbers of Fedora and RHEL are so different switch to defining
variables to indicate which features should be enabled.  Works for
Fedora 23.
This commit is contained in:
Todd C. Miller
2016-02-01 11:07:10 -07:00
parent 25abb72184
commit 9b19ea440c
2 changed files with 66 additions and 21 deletions

51
mkpkg
View File

@@ -110,30 +110,55 @@ fi
# Choose configure options by osversion. # Choose configure options by osversion.
# We use the same configure options as vendor packages when possible. # We use the same configure options as vendor packages when possible.
case "$osversion" in case "$osversion" in
centos*|rhel*|fc*) centos*|rhel*|f[0-9]*)
case "$osversion" in
centos*|rhel*)
if [ $osrelease -ge 40 ]; then if [ $osrelease -ge 40 ]; then
# RHEL 4 and up support SELinux # RHEL 4 and up support SELinux
configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux" with_selinux=true
fi
if [ $osrelease -ge 50 ]; then if [ $osrelease -ge 50 ]; then
# RHEL 5 and up has audit support and uses a separate PAM # RHEL 5 and up has audit support and uses a
# config file for "sudo -i". # separate PAM config file for "sudo -i".
configure_opts="${configure_opts}${configure_opts+$tab}--with-linux-audit" with_linux_audit=true
configure_opts="${configure_opts}${configure_opts+$tab}--with-pam-login" with_pam_login=true
PPVARS="${PPVARS}${PPVARS+$space}linux_audit=1.4.0"
fi
if [ $osrelease -ge 60 ]; then if [ $osrelease -ge 60 ]; then
# RHEL 6 and above builds sudo with SSSD support # RHEL 6 and above builds sudo with SSSD support
with_sssd=true
# RHEL 6 and above use /etc/sudo-ldap.conf
with_sudo_ldap_conf=true
fi
fi
fi
;;
f[0-9]*)
# XXX - investigate which features were in which fedora version
with_selinux=true
with_linux_audit=true
with_pam_login=true
with_sssd=true
with_sudo_ldap_conf=true
;;
esac
if [ X"$with_selinux" = X"true" ]; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-selinux"
fi
if [ X"$with_linux_audit" = X"true" ]; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-linux-audit"
PPVARS="${PPVARS}${PPVARS+$space}linux_audit=1.4.0"
fi
if [ X"$with_pam_login" = X"true" ]; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-pam-login"
fi
if [ X"$with_sssd" = X"true" ]; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd" configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd"
if test "`getconf LONG_BIT`" = "64"; then if test "`getconf LONG_BIT`" = "64"; then
# SSSD backend needs to know where to find the sssd lib # SSSD backend needs to know where to find the sssd lib
configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd-lib=/usr/lib64" configure_opts="${configure_opts}${configure_opts+$tab}--with-sssd-lib=/usr/lib64"
fi fi
# RHEL 6 and above use /etc/sudo-ldap.conf
if test "$flavor" = "ldap"; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap
--with-ldap-conf-file=/etc/sudo-ldap.conf"
fi fi
if [ X"$with_sudo_ldap_conf" = X"true" ]; then
configure_opts="${configure_opts}${configure_opts+$tab}--with-ldap-conf-file=/etc/sudo-ldap.conf"
fi fi
# Note, must indent with tabs, not spaces due to IFS trickery # Note, must indent with tabs, not spaces due to IFS trickery
configure_opts="--prefix=/usr configure_opts="--prefix=/usr

32
sudo.pp
View File

@@ -44,7 +44,7 @@ still allow people to get their work done."
pp_rpm_release="`expr \( $version : '.*p\([0-9][0-9]*\)$' \| 0 \) + 1`" pp_rpm_release="`expr \( $version : '.*p\([0-9][0-9]*\)$' \| 0 \) + 1`"
pp_rpm_version="`expr \( $version : '\(.*\)p[0-9][0-9]*$' \| $version \)`" pp_rpm_version="`expr \( $version : '\(.*\)p[0-9][0-9]*$' \| $version \)`"
pp_rpm_license="BSD" pp_rpm_license="BSD"
pp_rpm_url="https://www.sudo.ws/" pp_rpm_url="https://www.sudo.ws"
pp_rpm_group="Applications/System" pp_rpm_group="Applications/System"
pp_rpm_packager="Todd C. Miller <Todd.Miller@courtesan.com>" pp_rpm_packager="Todd C. Miller <Todd.Miller@courtesan.com>"
if test -n "$linux_audit"; then if test -n "$linux_audit"; then
@@ -86,7 +86,7 @@ still allow people to get their work done."
# Add distro info to release # Add distro info to release
osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*\([0-9]\{1,2\}\).*/\1/'` osrelease=`echo "$pp_rpm_distro" | sed -e 's/^[^0-9]*\([0-9]\{1,2\}\).*/\1/'`
case "$pp_rpm_distro" in case "$pp_rpm_distro" in
centos*|rhel*|fc*) centos*|rhel*|f[0-9]*)
pp_rpm_release="$pp_rpm_release.el${osrelease%%[0-9]}" pp_rpm_release="$pp_rpm_release.el${osrelease%%[0-9]}"
;; ;;
sles*) sles*)
@@ -97,7 +97,7 @@ still allow people to get their work done."
# Uncomment some Defaults in sudoers # Uncomment some Defaults in sudoers
# Note that the order must match that of sudoers. # Note that the order must match that of sudoers.
case "$pp_rpm_distro" in case "$pp_rpm_distro" in
centos*|rhel*|fc*) centos*|rhel*|f[0-9]*)
chmod u+w ${pp_destdir}${sudoersdir}/sudoers chmod u+w ${pp_destdir}${sudoersdir}/sudoers
/bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF'
/Locale settings/+1,s/^# // /Locale settings/+1,s/^# //
@@ -124,7 +124,7 @@ still allow people to get their work done."
# For RedHat the doc dir is expected to include version and release # For RedHat the doc dir is expected to include version and release
case "$pp_rpm_distro" in case "$pp_rpm_distro" in
centos*|rhel*|fc*) centos*|rhel*|f[0-9]*)
rhel_docdir="${docdir}-${pp_rpm_version}-${pp_rpm_release}" rhel_docdir="${docdir}-${pp_rpm_version}-${pp_rpm_release}"
if test "`dirname ${exampledir}`" = "${docdir}"; then if test "`dirname ${exampledir}`" = "${docdir}"; then
exampledir="${rhel_docdir}/`basename ${exampledir}`" exampledir="${rhel_docdir}/`basename ${exampledir}`"
@@ -136,7 +136,7 @@ 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*|rhel*|fc*) centos*|rhel*)
mkdir -p ${pp_destdir}/etc/pam.d mkdir -p ${pp_destdir}/etc/pam.d
if test $osrelease -lt 50; then if test $osrelease -lt 50; then
cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF
@@ -165,6 +165,26 @@ still allow people to get their work done."
EOF EOF
fi fi
;; ;;
f[0-9]*)
# XXX - share with 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
;;
sles*) sles*)
mkdir -p ${pp_destdir}/etc/pam.d mkdir -p ${pp_destdir}/etc/pam.d
if test $osrelease -lt 10; then if test $osrelease -lt 10; then
@@ -263,7 +283,7 @@ still allow people to get their work done."
cp -p %{pp_wrkdir}/%{name}/DEBIAN/control %{pp_wrkdir}/%{name}/DEBIAN/control.$$ cp -p %{pp_wrkdir}/%{name}/DEBIAN/control %{pp_wrkdir}/%{name}/DEBIAN/control.$$
sed "s/^\(Depends:.*\) *$/\1, ${DEPENDS}/" %{pp_wrkdir}/%{name}/DEBIAN/control.$$ > %{pp_wrkdir}/%{name}/DEBIAN/control sed "s/^\(Depends:.*\) *$/\1, ${DEPENDS}/" %{pp_wrkdir}/%{name}/DEBIAN/control.$$ > %{pp_wrkdir}/%{name}/DEBIAN/control
rm -f %{pp_wrkdir}/%{name}/DEBIAN/control.$$ rm -f %{pp_wrkdir}/%{name}/DEBIAN/control.$$
echo "Homepage: https://www.sudo.ws/" >> %{pp_wrkdir}/%{name}/DEBIAN/control echo "Homepage: https://www.sudo.ws" >> %{pp_wrkdir}/%{name}/DEBIAN/control
echo "Bugs: https://bugzilla.sudo.ws" >> %{pp_wrkdir}/%{name}/DEBIAN/control echo "Bugs: https://bugzilla.sudo.ws" >> %{pp_wrkdir}/%{name}/DEBIAN/control
%files %files