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
This commit is contained in:
Marcus Meissner 2014-03-28 16:04:21 +00:00 committed by Git OBS Bridge
parent a8582c8355
commit e543ab3c80
5 changed files with 79 additions and 2 deletions

View File

@ -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

View File

@ -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

14
service.clamav-milter Normal file
View File

@ -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

13
service.clamd Normal file
View File

@ -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

13
service.freshclam Normal file
View File

@ -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