diff --git a/clamav-clamonacc-service.patch b/clamav-clamonacc-service.patch new file mode 100644 index 0000000..30f59a6 --- /dev/null +++ b/clamav-clamonacc-service.patch @@ -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 diff --git a/clamav.spec b/clamav.spec index 7d250fa..480c8e9 100644 --- a/clamav.spec +++ b/clamav.spec @@ -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 diff --git a/clamonacc.service b/clamonacc.service deleted file mode 100644 index e35c08d..0000000 --- a/clamonacc.service +++ /dev/null @@ -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