Use but patch upstream's clamav-clamonacc.service

This commit is contained in:
Orion Poplawski 2020-09-18 20:16:33 -06:00
parent 2deba75778
commit a201bc2495
3 changed files with 35 additions and 20 deletions

View File

@ -0,0 +1,22 @@
diff -up clamav-0.103.0/clamonacc/clamav-clamonacc.service.in.clamonacc-service clamav-0.103.0/clamonacc/clamav-clamonacc.service.in
--- clamav-0.103.0/clamonacc/clamav-clamonacc.service.in.clamonacc-service 2020-09-12 18:27:09.000000000 -0600
+++ clamav-0.103.0/clamonacc/clamav-clamonacc.service.in 2020-09-18 19:49:35.400152760 -0600
@@ -4,14 +4,14 @@
[Unit]
Description=ClamAV On-Access Scanner
Documentation=man:clamonacc(8) man:clamd.conf(5) https://www.clamav.net/documents
-Requires=clamav-daemon.service
-After=clamav-daemon.service syslog.target network.target
+Requires=clamd@scan.service
+After=clamd@scan.service syslog.target network.target
[Service]
Type=simple
User=root
-ExecStartPre=/bin/bash -c "while [ ! -S /run/clamav/clamd.ctl ]; do sleep 1; done"
-ExecStart=@prefix@/sbin/clamonacc -F --config-file=@APP_CONFIG_DIRECTORY@/clamd.conf --log=/var/log/clamav/clamonacc.log --move=/root/quarantine
+ExecStartPre=/bin/bash -c "while [ ! -S /run/clamd.scan/clamd.sock ]; do sleep 1; done"
+ExecStart=@prefix@/sbin/clamonacc -F --config-file=/etc/clamd/scan.conf --log=/var/log/clamav/clamonacc.log --move=/root/quarantine
[Install]
WantedBy=multi-user.target

View File

@ -67,8 +67,6 @@ Source10: main-59.cvd
Source11: daily-25931.cvd
#http://database.clamav.net/bytecode.cvd
Source12: bytecode-331.cvd
#for clamonacc
Source100: clamonacc.service
#for update
Source200: freshclam-sleep
Source201: freshclam.sysconfig
@ -94,6 +92,8 @@ Patch3: clamav-curl.patch
# Fix ck_assert_msg() call
# https://github.com/Cisco-Talos/clamav-devel/pull/138
Patch4: clamav-check.patch
# Modify clamav-clamonacc.service for Fedora compatibility
Patch5: clamav-clamonacc-service.patch
BuildRequires: autoconf automake gettext-devel libtool libtool-ltdl-devel
BuildRequires: gcc-c++
@ -102,9 +102,9 @@ BuildRequires: curl-devel
BuildRequires: gmp-devel
BuildRequires: json-c-devel
BuildRequires: libprelude-devel
# libprelude-config --libs brings in gnutls
# libprelude-config --libs brings in gnutls, pcre
# https://bugzilla.redhat.com/show_bug.cgi?id=1830473
BuildRequires: gnutls-devel
BuildRequires: gnutls-devel pcre-devel
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
@ -257,6 +257,7 @@ This package contains files which are needed to run the clamav-milter.
# Patch to use older libcurl
%{?el7:%patch3 -p1 -b .curl}
%patch4 -p1 -b .check
%patch5 -p1 -b .clamonacc-service
install -p -m0644 %SOURCE300 clamav-milter/
@ -329,9 +330,10 @@ install -D -m 0644 -p %SOURCE5 _doc_server/README
## Fixup URL for EPEL
%{?epel:sed -i -e s/product=Fedora/product=Fedora%20EPEL/ _doc_server/README}
install -D -p -m 0644 %SOURCE100 $RPM_BUILD_ROOT%_unitdir/clamonacc.service
## For compatibility with 0.102.2-7
ln -s clamav-clamonacc.service $RPM_BUILD_ROOT%_unitdir/clamonacc.service
install -D -p -m 0644 %SOURCE530 $RPM_BUILD_ROOT%_unitdir/clamd@.service
install -D -p -m 0644 %SOURCE530 $RPM_BUILD_ROOT%_unitdir/clamd@.service
## prepare the update-files
install -D -m 0644 -p %SOURCE203 $RPM_BUILD_ROOT%_sysconfdir/logrotate.d/clamav-update
@ -423,13 +425,13 @@ make check
%post
%systemd_post clamonacc.service
%systemd_post clamav-clamonacc.service
%preun
%systemd_preun clamonacc.service
%systemd_preun clamav-clamonacc.service
%postun
%systemd_postun_with_restart clamonacc.service
%systemd_postun_with_restart clamav-clamonacc.service
%pre filesystem
@ -534,9 +536,11 @@ fi
%_sbindir/clamonacc
%endif
%_mandir/man[15]/*
%_mandir/man8/clamonacc.8*
%exclude %_mandir/*/freshclam*
%exclude %_mandir/man5/clamd.conf.5*
%_unitdir/clamonacc.service
%_unitdir/clamav-clamonacc.service
%files lib

View File

@ -1,11 +0,0 @@
[Unit]
Description=Clam AntiVirus userspace daemon for OnAccess Scanning
Documentation=man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/
ConditionPathExists=/etc/clamd.d/scan.conf
After=clamd@scan.service
[Service]
ExecStart=/usr/sbin/clamonacc --foreground
[Install]
WantedBy=multi-user.target