[pmg-devel] [PATCH proxmox-mailgateway 4/4] add initial-freshclam.service to pmg-container

Stoiko Ivanov s.ivanov at proxmox.com
Fri Dec 27 19:36:41 CET 2019

the proxmox-mailgateway-container metapackage is used to build our
Mailgateway container template with 'dab'. When creating the template
clamav-freshclam gets installed, but does not download the virus-definitions
resulting in 'clamav-daemon' not starting upon first boot of the PMG

By adding a service file which invokes 'freshclam' and blocks until the files
are downloaded, which adds a dependency on itself to clamav-daemon the daemon
starts successfully on the first boot of a container.

Not needed for non-container installations.

Tested by adding and enabling the service file on a freshly created (and never
started) pmg-6.1 container and booting it - clamav was running happily after
the download. After a reboot the service did not run because
of the ConditionPathExistsGlob

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
 ...gateway-container.initial-freshclam.service | 18 ++++++++++++++++++
 ...mox-mailgateway-container.lintian-overrides |  1 +
 debian/rules                                   |  2 ++
 3 files changed, 21 insertions(+)
 create mode 100644 debian/proxmox-mailgateway-container.initial-freshclam.service

diff --git a/debian/proxmox-mailgateway-container.initial-freshclam.service b/debian/proxmox-mailgateway-container.initial-freshclam.service
new file mode 100644
index 0000000..58a7ba0
--- /dev/null
+++ b/debian/proxmox-mailgateway-container.initial-freshclam.service
@@ -0,0 +1,18 @@
+Description=Initial download of ClamAV defintion files
+#inverted to the one in clamav-daemon.service
+Before=clamav-daemon.service clamav-freshclam.service
+ExecStart=/usr/bin/freshclam --quiet
+WantedBy=multi-user.target clamav-daemon.service clamav-freshclam.service
diff --git a/debian/proxmox-mailgateway-container.lintian-overrides b/debian/proxmox-mailgateway-container.lintian-overrides
index d324f05..c85797e 100644
--- a/debian/proxmox-mailgateway-container.lintian-overrides
+++ b/debian/proxmox-mailgateway-container.lintian-overrides
@@ -1 +1,2 @@
 proxmox-mailgateway-container: package-installs-apt-keyring etc/apt/trusted.gpg.d/proxmox-ve-release-*
+proxmox-mailgateway-container: systemd-service-file-refers-to-unusual-wantedby-target lib/systemd/system/initial-freshclam.service clamav-*.service
diff --git a/debian/rules b/debian/rules
index 0c06312..d985472 100644
--- a/debian/rules
+++ b/debian/rules
@@ -7,3 +7,5 @@
 	dh $@
+	dh_installsystemd --no-start --name=initial-freshclam

More information about the pmg-devel mailing list