From e543ab3c80279ecedde4de94678b774cda93f4f43032f03abd5632f7523ca919 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 28 Mar 2014 16:04:21 +0000 Subject: [PATCH] Accepting request 226920 from home:bmanojlovic:branches:security - initial systemd support unit files OBS-URL: https://build.opensuse.org/request/show/226920 OBS-URL: https://build.opensuse.org/package/show/security/clamav?expand=0&rev=95 --- clamav.changes | 5 +++++ clamav.spec | 36 ++++++++++++++++++++++++++++++++++-- service.clamav-milter | 14 ++++++++++++++ service.clamd | 13 +++++++++++++ service.freshclam | 13 +++++++++++++ 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 service.clamav-milter create mode 100644 service.clamd create mode 100644 service.freshclam diff --git a/clamav.changes b/clamav.changes index 4b90f0a..e883186 100644 --- a/clamav.changes +++ b/clamav.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 13 15:41:18 UTC 2014 - boris@steki.net + +- initial systemd support unit files + ------------------------------------------------------------------- Wed Feb 19 07:02:06 UTC 2014 - meissner@suse.com diff --git a/clamav.spec b/clamav.spec index fcd3c72..263a9de 100644 --- a/clamav.spec +++ b/clamav.spec @@ -64,11 +64,17 @@ Source3: clamav-updateclamconf Source4: clamav-rpmlintrc Source5: clamav-rcmilter Source6: clamav-tmpfiles.conf +Source7: service.clamd +Source8: service.freshclam +Source9: service.clamav-milter Patch1: clamav-conf.patch Patch2: clamav-sles9.patch Patch3: clamav-gcc47.patch Patch4: clamav-fan-syscalls.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if 0%{?suse_version} >= 1210 +BuildRequires: systemd +%endif %description ClamAV is an open source (GPL) antivirus engine designed for detecting @@ -152,6 +158,21 @@ mv clamav-milter.conf.sample clamav-milter.conf mv freshclam.conf.sample freshclam.conf popd +# Systemd... +%if 0%{?suse_version} >= 1210 +install -d -m 0755 %buildroot/%{_unitdir} +install -m 0644 %{SOURCE7} %buildroot/%{_unitdir}/clamd.service +install -m 0644 %{SOURCE8} %buildroot/%{_unitdir}/freshclam.service +install -m 0644 %{SOURCE9} %buildroot/%{_unitdir}/clamav-milter.service +# this is broken if system does not have systemd so don't +# use it at all on systems without mandatory systemd +%if 0%{?suse_version} >= 1230 +for srvname in clamd freshclam clamav-milter;do + (export PATH=/sbin:/usr/sbin:$PATH ;ln -sf $(which service) %{buildroot}/%{_sbindir}/rc${srvname}) +done +%endif +%endif + %check # regression tests @@ -163,6 +184,12 @@ VALGRIND_GENSUP=1 make check %defattr(-,root,root,-) %config(noreplace) %_sysconfdir/*.conf %config %attr(744,root,root)/etc/init.d/* +#systemd... +%if 0%{?suse_version} >= 1210 +%{_unitdir}/clamd.service +%{_unitdir}/freshclam.service +%{_unitdir}/clamav-milter.service +%endif %_tmpfilesdir %doc AUTHORS BUGS ChangeLog COPYING FAQ NEWS README UPGRADE %doc docs/*.pdf docs/html @@ -183,6 +210,9 @@ VALGRIND_GENSUP=1 make check %_sbindir/usermod vscan -g vscan 2> /dev/null || : %post +%{fillup_and_insserv clamd} +%{fillup_and_insserv freshclam} +#%%{fillup_and_insserv clamav-filter} /sbin/ldconfig # merge config files on update test "0$1" -lt 2 && exit 0 @@ -199,14 +229,16 @@ for f in /etc/clamd.conf /etc/freshclam.conf /etc/clamav-milter.conf; do fi fi done +%if 0%{?suse_version} >= 1210 systemd-tmpfiles --create %_tmpfilesdir/clamav.conf +%endif %preun -%stop_on_removal clamd freshclam +%stop_on_removal clamd freshclam clamav-milter %postun /sbin/ldconfig -%restart_on_update clamd freshclam +%restart_on_update clamd freshclam clamav-milter %insserv_cleanup %changelog diff --git a/service.clamav-milter b/service.clamav-milter new file mode 100644 index 0000000..21d7467 --- /dev/null +++ b/service.clamav-milter @@ -0,0 +1,14 @@ +[Unit] +Description=Clamav antivirus milter daemon +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/clamav-milter +; it will switch to vscan user +;User=vscan +;Group=vscan +;PrivateTmp=yes + +[Install] +WantedBy=multi-user.target diff --git a/service.clamd b/service.clamd new file mode 100644 index 0000000..537c74d --- /dev/null +++ b/service.clamd @@ -0,0 +1,13 @@ +[Unit] +Description=Clamav antivirus Deamon +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/clamd +;User=vscan +;Group=vscan +;PrivateTmp=yes + +[Install] +WantedBy=multi-user.target diff --git a/service.freshclam b/service.freshclam new file mode 100644 index 0000000..30d470c --- /dev/null +++ b/service.freshclam @@ -0,0 +1,13 @@ +[Unit] +Description=Freshclam virus definitions downloader +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/bin/freshclam -d +;User=vscan +;Group=vscan +;PrivateTmp=yes + +[Install] +WantedBy=multi-user.target