commit 0e480f7f6823905354bc4b4a56f2152d39718f8f Author: Nathanael D. Noblet <nathanael@xxxxxxx> Date: Wed Jul 13 14:48:56 2011 -0600 Initial systemd unit file dspam-systemd | 11 +++++++++++ dspam.spec | 39 +++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 16 deletions(-) --- diff --git a/dspam-systemd b/dspam-systemd new file mode 100644 index 0000000..66d14ea --- /dev/null +++ b/dspam-systemd @@ -0,0 +1,11 @@ +[Unit] +Description=A highly accurate statistical spam filter minimal resources + +[Service] +Type=Forking +EnvironmentFile=-/etc/sysconfig/dspam +User=${DSPAM_USER} +ExecStart=${DSPAM_BIN} --daemon 2>/dev/null + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/dspam.spec b/dspam.spec index 327195e..3970b09 100644 --- a/dspam.spec +++ b/dspam.spec @@ -11,7 +11,7 @@ Summary: A library and Mail Delivery Agent for Bayesian SPAM filtering Name: dspam Version: 3.9.0 -Release: 21%{?dist} +Release: 22%{?dist} License: GPLv2 Group: System Environment/Daemons Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz @@ -22,6 +22,7 @@ Source4: dspam-web.conf Source5: dspam-front Source6: dspam-sysconfig Source7: dspam-tmpfiles +Source8: dspam-systemd Source99: dspam-filter-requires.sh Patch0: dspam-3.9.0-file-name.patch Patch1: dspam-3.9.0-docs.patch @@ -36,11 +37,10 @@ BuildRequires: mysql-devel BuildRequires: postgresql-devel BuildRequires: sqlite-devel BuildRequires: openldap-devel +BuildRequires: systemd-units Requires: dspam-libs = %{version}-%{release} -Requires(post): chkconfig -Requires(preun): chkconfig -Requires(preun): initscripts +Requires(post): systemd-sysv %description The DSPAM agent masquerades as the email server's local delivery agent @@ -127,7 +127,6 @@ Summary: Web-based interface for DSPAM Group: System Environment/Daemons Requires: dspam = %{version}-%{release} Requires: webserver -Requires(post): initscripts %description web Web-based interface for DSPAM's powerful Anti-Spam engine. @@ -218,8 +217,8 @@ find $RPM_BUILD_ROOT -name *.a -exec rm {} \; echo "Scanned and tagged as SPAM with DSPAM %{version} by Your ISP.com"> $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.spam echo "Scanned and tagged as non-SPAM with DSPAM %{version} by Your ISP.com"> $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.nonspam -# install init.d script -%{__install} -Dp -m0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/dspam +# install systemd script +%{__install} -Dp -m0644 %{SOURCE8} $RPM_BUILD_ROOT%{_unitdir}/dspam.service # install cron script %{__install} -Dp -m0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/dspam @@ -263,21 +262,26 @@ do done %{__install} -Dp -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/ +[...] %post -/sbin/chkconfig --add %{name} -if [ $1 -gt 1 ]; then -/sbin/chkconfig %{name} resetpriorities +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi %preun -if [ $1 -eq 0 ]; then - /sbin/service %{name} stop &>/dev/null || : - /sbin/chkconfig --del %{name} +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable dspam.service > /dev/null 2>&1 || : + /bin/systemctl stop dspam.service > /dev/null 2>&1 || : fi %postun -if [ $1 -ge 1 ]; then - /sbin/service %{name} condrestart &>/dev/null || : +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + /sbin/chkconfig --del httpd >/dev/null 2>&1 || : + # Package upgrade, not uninstall + /bin/systemctl try-restart dspam.service >/dev/null 2>&1 || : fi %pre libs @@ -309,7 +313,7 @@ exit 0 %config(noreplace) %{_sysconfdir}/logrotate.d/dspam %attr(0640,root,%{mail_group}) %config(noreplace) %{dspam_confdir}/dspam.conf %attr(0644,root,%{mail_group}) %config(noreplace) %{dspam_confdir}/dspam.conf.default -%{_initrddir}/dspam +%{_unitdir}/dspam.service %{_mandir}/man1/* %attr(%{dspam_mode},%{dspam_user},%{mail_group}) %{_bindir}/dspam %{_bindir}/dspam_2sql @@ -376,6 +380,9 @@ exit 0 %config(noreplace) %{_sysconfdir}/httpd/conf.d/dspam-web.conf %changelog +* Wed Jul 13 2011 Nathanael Noblet <nathanael@xxxxxxx> - 3.9.0-22 +- Systemd unit file + * Wed Jul 13 2011 Nathanael Noblet <nathanael@xxxxxxx> - 3.9.0-21 - Start daemon as dspam user -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list perl-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/perl-devel