Enabled alternatives --initscript in post section

Improved sysvinit subpackage - switched to noarch, added scriptlets
Workarounded sm-client stop on SysV to systemd migration
This commit is contained in:
Jaroslav Škarvada 2011-09-19 16:01:13 +02:00
parent c50c737f7d
commit 648155a581

View File

@ -11,6 +11,8 @@
%global spooldir %{_localstatedir}/spool %global spooldir %{_localstatedir}/spool
%global maildir %{_sysconfdir}/mail %global maildir %{_sysconfdir}/mail
%global sysv2systemdnvr 8.14.5-3
# hardened build if not overrided # hardened build if not overrided
%{!?_hardened_build:%global _hardened_build 1} %{!?_hardened_build:%global _hardened_build 1}
@ -21,7 +23,7 @@
Summary: A widely used Mail Transport Agent (MTA) Summary: A widely used Mail Transport Agent (MTA)
Name: sendmail Name: sendmail
Version: 8.14.5 Version: 8.14.5
Release: 8%{?dist} Release: 9%{?dist}
License: Sendmail License: Sendmail
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.sendmail.org/ URL: http://www.sendmail.org/
@ -106,7 +108,7 @@ BuildRequires: ghostscript
BuildRequires: m4 BuildRequires: m4
BuildRequires: systemd-units BuildRequires: systemd-units
Provides: MTA smtpdaemon server(smtp) 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(preun): systemd-units %{_sbindir}/alternatives
Requires(postun): systemd-units coreutils %{_sbindir}/alternatives Requires(postun): systemd-units coreutils %{_sbindir}/alternatives
Requires(pre): shadow-utils Requires(pre): shadow-utils
@ -141,7 +143,10 @@ Sendmail, you can install the sendmail-doc package.
%package sysvinit %package sysvinit
Summary: SysV initscript for sendmail Summary: SysV initscript for sendmail
Group: System Environment/Daemons Group: System Environment/Daemons
BuildArch: noarch
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires(preun): chkconfig
Requires(post): chkconfig
%description sysvinit %description sysvinit
This package contains the SysV initscript. 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/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}/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}/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 --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 > /dev/null 2>&1
# --initscript sendmail
# Rebuild maps. # Rebuild maps.
{ {
@ -560,13 +564,32 @@ exit 0
%postun milter -p /sbin/ldconfig %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 ||: %{_bindir}/systemd-sysv-convert --save sendmail >/dev/null 2>&1 ||:
/bin/systemctl enable sendmail.service >/dev/null 2>&1 /bin/systemctl enable sendmail.service >/dev/null 2>&1
/bin/systemctl enable sm-client.service >/dev/null 2>&1 /bin/systemctl enable sm-client.service >/dev/null 2>&1
/sbin/chkconfig --del sendmail >/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 sendmail.service >/dev/null 2>&1 || :
/bin/systemctl try-restart sm-client.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 %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -696,6 +719,11 @@ exit 0
%{_initrddir}/sendmail %{_initrddir}/sendmail
%changelog %changelog
* Tue Sep 13 2011 Jaroslav Škarvada <jskarvad@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@redhat.com> - 8.14.5-8 * Tue Aug 30 2011 Jaroslav Škarvada <jskarvad@redhat.com> - 8.14.5-8
- Enable override of hardened build settings - Enable override of hardened build settings