[sendmail] Enabled alternatives --initscript in post section Improved sysvinit subpackage - switched to noarch,

Jaroslav Škarvada jskarvad at fedoraproject.org
Mon Sep 19 14:01:33 UTC 2011


commit 648155a581f75addb0286c13506174357bc2e0dd
Author: Jaroslav Škarvada <jskarvad at redhat.com>
Date:   Mon Sep 19 16:01:13 2011 +0200

    Enabled alternatives --initscript in post section
    Improved sysvinit subpackage - switched to noarch, added scriptlets
    Workarounded sm-client stop on SysV to systemd migration

 sendmail.spec |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/sendmail.spec b/sendmail.spec
index 5f0903c..5c1e7a4 100644
--- a/sendmail.spec
+++ b/sendmail.spec
@@ -11,6 +11,8 @@
 %global spooldir %{_localstatedir}/spool
 %global maildir %{_sysconfdir}/mail
 
+%global sysv2systemdnvr 8.14.5-3
+
 # hardened build if not overrided
 %{!?_hardened_build:%global _hardened_build 1}
 
@@ -21,7 +23,7 @@
 Summary: A widely used Mail Transport Agent (MTA)
 Name: sendmail
 Version: 8.14.5
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: Sendmail
 Group: System Environment/Daemons
 URL: http://www.sendmail.org/
@@ -106,7 +108,7 @@ BuildRequires: ghostscript
 BuildRequires: m4
 BuildRequires: systemd-units
 Provides: MTA smtpdaemon server(smtp)
-Requires(post): systemd-units systemd-sysv chkconfig coreutils %{_sbindir}/alternatives
+Requires(post): systemd-units systemd-sysv coreutils %{_sbindir}/alternatives
 Requires(preun): systemd-units %{_sbindir}/alternatives
 Requires(postun): systemd-units coreutils %{_sbindir}/alternatives
 Requires(pre): shadow-utils
@@ -141,7 +143,10 @@ Sendmail, you can install the sendmail-doc package.
 %package sysvinit
 Summary: SysV initscript for sendmail
 Group: System Environment/Daemons
+BuildArch: noarch
 Requires: %{name} = %{version}-%{release}
+Requires(preun): chkconfig
+Requires(post): chkconfig
 
 %description sysvinit
 This package contains the SysV initscript.
@@ -525,9 +530,8 @@ fi
 	--slave %{_mandir}/man1/mailq.1.gz mta-mailqman %{_mandir}/man1/mailq.sendmail.1.gz \
 	--slave %{_mandir}/man1/newaliases.1.gz mta-newaliasesman %{_mandir}/man1/newaliases.sendmail.1.gz \
 	--slave %{_mandir}/man5/aliases.5.gz mta-aliasesman %{_mandir}/man5/aliases.sendmail.5.gz \
-	--slave %{_mandir}/man8/rmail.8.gz mta-rmailman %{_mandir}/man8/rmail.sendmail.8.gz
-# it is not yet supported in systemd #714830, #697636
-#	--initscript sendmail
+	--slave %{_mandir}/man8/rmail.8.gz mta-rmailman %{_mandir}/man8/rmail.sendmail.8.gz \
+	--initscript sendmail > /dev/null 2>&1
 
 # Rebuild maps.
 {
@@ -560,13 +564,32 @@ exit 0
 
 %postun milter -p /sbin/ldconfig
 
-%triggerun -- sendmail < 8.14.5-3
+%post sysvinit
+/sbin/chkconfig --add sendmail >/dev/null 2>&1 ||:
+
+%preun sysvinit
+if [ "$1" = 0 ]; then
+	%{_initrddir}/sendmail stop >/dev/null 2>&1 ||:
+	/sbin/chkconfig --del sendmail >/dev/null 2>&1 ||:
+fi
+
+%postun sysvinit
+[ "$1" -ge "1" ] && %{_initrddir}/sendmail condrestart >/dev/null 2>&1 ||:
+
+%triggerun -- sendmail < %{sysv2systemdnvr}
 %{_bindir}/systemd-sysv-convert --save sendmail >/dev/null 2>&1 ||:
 /bin/systemctl enable sendmail.service >/dev/null 2>&1
 /bin/systemctl enable sm-client.service >/dev/null 2>&1
 /sbin/chkconfig --del sendmail >/dev/null 2>&1 || :
 /bin/systemctl try-restart sendmail.service >/dev/null 2>&1 || :
 /bin/systemctl try-restart sm-client.service >/dev/null 2>&1 || :
+# workaround for systemd rhbz#738022
+/bin/systemctl is-active sendmail.service >/dev/null 2>&1 && \
+	! /bin/systemctl is-active sm-client.service >/dev/null 2>&1 && \
+	/bin/systemctl start sm-client.service >/dev/null 2>&1 || :
+
+%triggerpostun -n sendmail-sysvinit -- sendmail < %{sysv2systemdnvr}
+/sbin/chkconfig --add sendmail >/dev/null 2>&1 || :
 
 %files
 %defattr(-,root,root,-)
@@ -696,6 +719,11 @@ exit 0
 %{_initrddir}/sendmail
 
 %changelog
+* Tue Sep 13 2011 Jaroslav Škarvada <jskarvad at redhat.com> - 8.14.5-9
+- Enabled alternatives --initscript in post section
+- Improved sysvinit subpackage - switched to noarch, added scriptlets
+- Workarounded sm-client stop on SysV to systemd migration
+
 * Tue Aug 30 2011 Jaroslav Škarvada <jskarvad at redhat.com> - 8.14.5-8
 - Enable override of hardened build settings
 


More information about the scm-commits mailing list