[mailman] fix #719371 - added native systemd unit file
Jan Kaluža
jkaluza at fedoraproject.org
Thu Jul 14 09:25:57 UTC 2011
commit 2f51b820fe2a209f1866d9b62be25caaf62c395e
Author: Jan Kaluza <hanzz.k at gmail.com>
Date: Thu Jul 14 11:24:58 2011 +0200
fix #719371 - added native systemd unit file
mailman.spec | 47 +++++++++++++++++++++++++++++++++++++----------
1 files changed, 37 insertions(+), 10 deletions(-)
---
diff --git a/mailman.spec b/mailman.spec
index 9fdec70..c36a7ee 100644
--- a/mailman.spec
+++ b/mailman.spec
@@ -1,7 +1,7 @@
Summary: Mailing list manager with built in Web access
Name: mailman
Version: 2.1.14
-Release: 8%{?dist}
+Release: 9%{?dist}
Epoch: 3
Group: Applications/Internet
Source0: ftp://ftp.gnu.org/pub/gnu/mailman/mailman-%{version}.tgz
@@ -14,6 +14,7 @@ Source6: mailman-crontab-edit
Source7: mailman-migrate-fhs
Source8: mailman-update-cfg
Source9: mailman-tmpfiles.conf
+Source10: mailman.service
Patch1: mailman-2.1.12-multimail.patch
Patch2: mailman-2.1-build.patch
@@ -45,7 +46,12 @@ URL: http://www.list.org/
BuildRoot: %{_tmppath}/%{name}-root
Requires(pre): shadow-utils, /sbin/chkconfig, /sbin/service
Requires: vixie-cron >= 4.1-9, httpd, python >= 2.2, mktemp
+Requires(post): systemd-units
+Requires(post): systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
BuildRequires: python-devel >= 2.2, automake
+BuildRequires: systemd-units
%define contentdir /var/www
@@ -195,10 +201,6 @@ rm -fr $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
#make install prefix=$RPM_BUILD_ROOT%{mmdir} var_prefix=$RPM_BUILD_ROOT%{varmmdir}
-# Install the mailman init.d script
-mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
-install $RPM_BUILD_ROOT%{mmdir}/scripts/mailman $RPM_BUILD_ROOT/etc/rc.d/init.d/mailman
-
# Install the mailman cron.d script
mkdir -p $RPM_BUILD_ROOT/etc/cron.d
cat > $RPM_BUILD_ROOT/etc/cron.d/%{name} <<EOF
@@ -290,6 +292,10 @@ mkdir -p $RPM_BUILD_ROOT/%{queuedir}
install -p -D %{SOURCE9} %{buildroot}%{_sysconfdir}/tmpfiles.d/mailman.conf
+# Systemd service file
+mkdir -p %{buildroot}%{_unitdir}
+install -m644 %{SOURCE10} %{buildroot}%{_unitdir}
+
%clean
rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.%{name}
@@ -331,14 +337,17 @@ if [ -f /var/spool/cron/%{mmuser} ]; then
crontab -u %{mmuser} -r
fi
-# This adds the proper /etc/rc*.d links for the script that runs the mailman qrunner daemon
-chkconfig --add mailman
-
# Restart mailman if it had been running before installation
if [ -e %{restart_flag} ]; then
rm %{restart_flag}
/sbin/service %{name} start >/dev/null 2>&1
fi
+
+# systemd
+if [ $1 -eq 1 ] ; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
@@ -350,7 +359,8 @@ exit 0
if [ $1 = 0 ]; then
# These statements stop the service, and remove the /etc/rc*.d links.
/sbin/service %{name} stop >/dev/null 2>&1
- /sbin/chkconfig --del %{name}
+ /bin/systemctl --no-reload mailman.service > /dev/null 2>&1 || :
+ /bin/systemctl stop mailman.service > /dev/null 2>&1 || :
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
@@ -359,9 +369,23 @@ exit 0
if [ $1 = 0 ]; then
crontab -u %{mmuser} -r 2>/dev/null
fi
+
+# systemd
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ /bin/systemctl try-restart mailman.service >/dev/null 2>&1 || :
+fi
+
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
+%triggerun -- mailman < 3:2.1.14-9
+%{_bindir}/systemd-sysv-convert --save mailman >/dev/null 2>&1 ||:
+/bin/systemctl enable mailman.service >/dev/null 2>&1
+/sbin/chkconfig --del mailman >/dev/null 2>&1 || :
+/bin/systemctl try-restart mailman.service >/dev/null 2>&1 || :
+
+
%files
%defattr(-,root,%{mmgroup})
%attr(2755,root,%{mmgroup}) %dir %{mmdir}
@@ -491,6 +515,7 @@ exit 0
%{mmdir}/Mailman/versions.py
%{mmdir}/Mailman/versions.pyc
%{mmdir}/Mailman/versions.pyo
+%{_unitdir}/mailman.service
%doc %{docdir}
%dir %attr(0755,root,root) %{contentdir}/icons
%attr(0644,root,root) %{contentdir}/icons/*
@@ -508,7 +533,6 @@ exit 0
%config(noreplace) %{_sysconfdir}/tmpfiles.d/mailman.conf
%attr(2775,root,%{mmgroup}) %{queuedir}
#%attr(2775,root,%{mmgroup}) %{piddir}
-%attr(0755,root,root) /etc/rc.d/init.d/%{name}
%attr(0644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/cron.d/mailman
%attr(0644,root,%{mmgroup}) %config(noreplace) %{mmdir}/cron/crontab.in
%attr(0755,root,root) %{_bindir}/mailman-update-cfg
@@ -516,6 +540,9 @@ exit 0
%attr(2770,%{cgiuser},%{mmgroup}) %{archivesdir}/private
%changelog
+* Wed Jul 13 2011 Jan Kaluza <jkaluza at redhat.com> - 3:2.1.14-9
+- fix #719371 - added native systemd unit file
+
* Wed May 18 2011 Jan Kaluza <jkaluza at redhat.com> - 3:2.1.14-8
- fix #701539 - fixed permissions of all directories in mailman dir
More information about the scm-commits
mailing list