Package: amavisd-new
Version: 1:2.7.1-2
Severity: wishlist
Tags: patch
User: pkg-systemd-maintain...@lists.alioth.debian.org
Usertags: systemd-units
X-Debbugs-CC: pkg-systemd-maintain...@lists.alioth.debian.org

Hi,

the attached patch adds a systemd service file for the main amavisd-new
daemon. There are some slight changes in comparison to the init script:
* the daemon will start, if there are *.disabled files around for
configuration files (this was seemingly introduced in 2006, because of a
configuration change, so I guess this is probably not needed anymore)
* the tmp files will be deleted before the start of amavis

The patch was tested against the current git version.
diff -Nru amavisd-new-2.8.0/debian/amavisd-new.amavis.service amavisd-new-2.8.0/debian/amavisd-new.amavis.service
--- amavisd-new-2.8.0/debian/amavisd-new.amavis.service	1970-01-01 01:00:00.000000000 +0100
+++ amavisd-new-2.8.0/debian/amavisd-new.amavis.service	2014-02-08 17:40:16.000000000 +0100
@@ -0,0 +1,13 @@
+[Unit]
+Description=Interface between MTA and virus scanner/content filters
+After=network.target
+
+[Service]
+PIDFile=/run/amavis/amavisd.pid
+ExecStart=/usr/sbin/amavisd-new foreground
+ExecReload=/usr/sbin/amavisd-new reload
+ExecStartPre=-/usr/bin/find /var/lib/amavis -maxdepth 1 -name 'amavis-*' -type d -exec rm -rf "{}" \;
+ExecStartPre=-/usr/bin/find /var/lib/amavis/tmp -maxdepth 1 -name 'amavis-*' -type d -exec rm -rf "{}" \;
+
+[Install]
+WantedBy=multi-user.target
diff -Nru amavisd-new-2.8.0/debian/amavisd-new.amavis.tmpfile amavisd-new-2.8.0/debian/amavisd-new.amavis.tmpfile
--- amavisd-new-2.8.0/debian/amavisd-new.amavis.tmpfile	1970-01-01 01:00:00.000000000 +0100
+++ amavisd-new-2.8.0/debian/amavisd-new.amavis.tmpfile	2014-02-08 16:48:30.000000000 +0100
@@ -0,0 +1 @@
+d	/run/amavis			0755	amavis amavis
diff -Nru amavisd-new-2.8.0/debian/control amavisd-new-2.8.0/debian/control
--- amavisd-new-2.8.0/debian/control	2014-02-08 01:10:52.000000000 +0100
+++ amavisd-new-2.8.0/debian/control	2014-02-07 18:37:17.000000000 +0100
@@ -4,7 +4,7 @@
 Maintainer: Brian May <b...@debian.org>
 Uploaders: Henrique de Moraes Holschuh <h...@debian.org>,
            Alexander Wirt <formo...@debian.org>
-Build-Depends: debhelper (>= 9), po-debconf, dh-exec
+Build-Depends: debhelper (>= 9), po-debconf, dh-exec, dh-systemd
 Standards-Version: 3.9.4
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=amavisd-new/pkg-amavisd-new.git;a=summary
 Vcs-Git: git://anonscm.debian.org/amavisd-new/pkg-amavisd-new.git
diff -Nru amavisd-new-2.8.0/debian/rules amavisd-new-2.8.0/debian/rules
--- amavisd-new-2.8.0/debian/rules	2014-02-08 01:10:52.000000000 +0100
+++ amavisd-new-2.8.0/debian/rules	2014-02-07 22:15:51.000000000 +0100
@@ -7,8 +7,10 @@
 	dh  $@
 
 override_dh_installinit:
+	dh_systemd_enable
 	dh_installinit --name=amavis
 	dh_installinit --name=amavisd-snmp-subagent
+	dh_systemd_start
 
 override_dh_installchangelogs:
 	dh_installchangelogs -k RELEASE_NOTES

Reply via email to