2 # - Make freshclam package (script and daemon)
3 # - restart amavis in triggers if group membership was modified?
6 %bcond_without milter # milter interface subpackage
7 %if "%{pld_release}" == "ac"
8 %bcond_with llvm # LLVM support
10 %bcond_without llvm # LLVM support
12 %bcond_without system_libmspack # system libmspack library
13 %bcond_with system_llvm # system LLVM (< 3.7)
14 %bcond_without static_libs # static libraries
19 Summary: An anti-virus utility for Unix
20 Summary(pl.UTF-8): Narzędzie antywirusowe dla Uniksów
26 #Source0Download: http://www.clamav.net/download
27 Source0: http://www.clamav.net/downloads/production/%{name}-%{version}.tar.gz
28 # Source0-md5: f895e9a261937ed91f5cb3ead4791555
30 Source2: %{name}.sysconfig
31 Source3: %{name}-milter.init
32 Source4: %{name}-cron-updatedb
33 Source5: %{name}.logrotate
34 Source8: %{name}-post-updatedb
35 Source9: %{name}-milter.sysconfig
36 Source10: %{name}.tmpfiles
37 Source11: clamd.service
38 Source12: cronjob-clamav.timer
39 Source13: cronjob-clamav.service.in
40 Patch0: %{name}-pld_config.patch
41 Patch1: %{name}-nolibs.patch
42 %if "%{pld_release}" == "ac"
43 Patch2: am-nosilentrules.patch
47 Patch5: %{name}-add-support-for-system-tomsfastmath.patch
48 Patch6: %{name}-headers.patch
49 URL: http://www.clamav.net/
50 BuildRequires: autoconf >= 2.59
51 BuildRequires: automake >= 1:1.11.1
52 BuildRequires: bzip2-devel >= 1.0.5
53 BuildRequires: check-devel
54 BuildRequires: curl-devel >= 7.40
55 BuildRequires: gmp-devel
56 BuildRequires: json-c-devel
57 BuildRequires: libltdl-devel
58 %{?with_milter:BuildRequires: libmilter-devel}
59 %{?with_system_libmspack:BuildRequires: libmspack-devel}
60 BuildRequires: libstdc++-devel >= 5:3.4
61 BuildRequires: libtool >= 2:2
62 %{?with_milter:BuildRequires: libwrap-devel}
63 BuildRequires: libxml2-devel >= 2
64 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
65 BuildRequires: ncurses-devel
66 BuildRequires: openssl-devel >= 0.9.8
67 BuildRequires: pcre2-8-devel >= 10.30
68 BuildRequires: pkgconfig >= 1:0.16
69 BuildRequires: rpm >= 4.4.9-56
70 BuildRequires: rpmbuild(macros) >= 1.647
71 BuildRequires: systemd-devel
72 BuildRequires: tomsfastmath-devel >= 0.13.1-2
73 BuildRequires: zlib-devel >= 1.2.2
74 Requires(post,preun): /sbin/chkconfig
75 Requires(postun): /usr/sbin/groupdel
76 Requires(postun): /usr/sbin/userdel
77 Requires(postun,pre): /usr/sbin/usermod
78 Requires(pre): /bin/id
79 Requires(pre): /usr/bin/getgid
80 Requires(pre): /usr/sbin/groupadd
81 Requires(pre): /usr/sbin/useradd
82 Requires(post,preun,postun): systemd-units >= 38
83 Requires: systemd-units >= 38
84 Requires(postun): sed >= 4.0
85 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
86 Requires: /usr/sbin/usermod
87 Requires: rc-scripts >= 0.4.1.23
88 Suggests: clamav-database
90 Provides: group(clamav)
91 Provides: user(clamav)
92 Conflicts: logrotate < 3.7-4
93 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
96 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
97 especially for e-mail scanning on mail gateways. It provides a number
98 of utilities including a flexible and scalable multi-threaded daemon,
99 a command line scanner and advanced tool for automatic database
100 updates. The core of the package is an anti-virus engine available in
101 a form of shared library (available in clamav-libs).
103 Here is a list of the main features:
104 - command-line scanner
105 - fast, multi-threaded daemon with support for on-access scanning
106 - milter interface for sendmail
107 - advanced database updater with support for scripted updates and
109 - virus scanner C library
110 - on-access scanning (Linux and FreeBSD)
111 - virus database updated multiple times per day (see home page for
112 total number of signatures)
113 - built-in support for various archive formats, including Zip, RAR,
114 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
115 - built-in support for almost all mail file formats
116 - built-in support for ELF executables and Portable Executable files
117 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
118 obfuscated with SUE, Y0da Cryptor and others
119 - built-in support for popular document formats including MS Office
120 and MacOffice files, HTML, RTF and PDF
122 %description -l pl.UTF-8
123 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
124 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
125 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
126 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
127 skaner działający z linii poleceń oraz zaawansowane narzędzie do
128 automatycznej aktualizacji bazy danych. Główna część pakietu to
129 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
130 (dostępnej w pakiecie clamav-libs).
132 Lista podstawowych możliwości:
133 - skaner działający z linii poleceń
134 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
135 - interfejs milter dla sendmaila
136 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
137 aktualizacji oskryptowanych oraz podpisów cyfrowych
138 - biblioteka C skanera antywirusowego
139 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
140 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
141 sygnatur dostępna na stronie projektu)
142 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
143 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
144 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
145 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
146 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
147 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
148 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
149 Office, MacOffice, HTML, RTF i PDF
152 Summary: Shared libraries for clamav
153 Summary(pl.UTF-8): Biblioteki dzielone clamav
155 Requires: bzip2-libs >= 1.0.5
156 Requires: curl-libs >= 7.40
157 Requires: pcre2-8 >= 10.30
158 Requires: zlib >= 1.2.2
161 Shared libraries for clamav.
163 %description libs -l pl.UTF-8
164 Biblioteki dzielone clamav.
167 Summary: ClamAV filter using milter interface
168 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
170 Requires: %{name} = %{epoch}:%{version}-%{release}
172 #Requires: sendmail >= 8.11
173 Requires: tcp_wrappers
176 ClamAV sendmail filter using MILTER interface.
178 %description milter -l pl.UTF-8
179 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
182 Summary: clamav - Development header files and libraries
183 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
184 Group: Development/Libraries
185 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
186 Requires: bzip2-devel >= 1.0.5
187 Requires: curl-devel >= 7.40
189 Requires: openssl-devel >= 0.9.8
190 Requires: pcre2-8-devel >= 10.30
191 Requires: zlib-devel >= 1.2.2
194 This package contains the development header files and libraries
195 necessary to develop clamav client applications.
197 %description devel -l pl.UTF-8
198 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
202 Summary: clamav static libraries
203 Summary(pl.UTF-8): Biblioteki statyczne clamav
204 Group: Development/Libraries
205 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
208 clamav static libraries.
210 %description static -l pl.UTF-8
211 Biblioteki statyczne clamav.
217 %if "%{pld_release}" == "ac"
220 %if "%{pld_release}" != "ac"
228 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
229 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
239 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
240 %{?with_milter:--enable-milter} \
241 --disable-silent-rules \
242 %{?with_static_libs:--enable-static} \
243 --disable-zlib-vcheck \
244 --with-dbdir=/var/lib/%{name} \
245 --with-ltdl-include=%{_includedir} \
246 --with-ltdl-lib=%{_libdir} \
248 %{?with_system_libmspack:--with-system-libmspack}
253 rm -rf $RPM_BUILD_ROOT
254 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
255 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
256 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
257 $RPM_BUILD_ROOT%{systemdunitdir}
260 DESTDIR=$RPM_BUILD_ROOT
261 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
263 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
264 5 * * * * root %{_sbindir}/clamav-cron-updatedb
267 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
269 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
270 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
272 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
273 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
274 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
277 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
279 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
281 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
283 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
284 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
285 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
287 # NOTE: clamd uses sane rights to it's clamd.pid file
288 # So better keep it dir
289 # If it is fixed use of dir will be unecesary
290 install -d $RPM_BUILD_ROOT/var/run/%{name}
292 :> $RPM_BUILD_ROOT/var/log/freshclam.log
295 rm -rf $RPM_BUILD_ROOT
297 %triggerin -- amavis-ng
298 %addusertogroup -q clamav amavis
300 %triggerin -- amavisd-new
301 %addusertogroup -q clamav amavis
303 %triggerin -- amavisd
304 %addusertogroup -q clamav amavis
307 %groupadd -g 43 clamav
308 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
311 /sbin/chkconfig --add clamd
312 %service clamd restart "Clam Antivirus daemon"
313 touch /var/log/freshclam.log
314 chown clamav:root /var/log/freshclam.log
315 chmod 640 /var/log/freshclam.log
316 %systemd_post clamd.service cronjob-clamav.timer
319 if [ "$1" = "0" ]; then
321 /sbin/chkconfig --del clamd
323 %systemd_preun clamd.service cronjob-clamav.timer
326 if [ "$1" = "0" ]; then
332 %triggerpostun -- %{name} < 0.99.2-2
333 if [ -f /etc/clamav.conf.rpmsave ]; then
334 echo "Renaming config to new name /etc/clamd.conf"
335 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
336 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
337 echo "Changing config location in freshclam config"
338 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
341 %{__cp} -f /etc/clamd.conf{,.rpmsave}
344 s,^FixStaleSocket$,& yes,
345 s,^AllowSupplementaryGroups$,& yes,
346 s,^ClamukoScanOnOpen$,& yes,
347 s,^ClamukoScanOnClose$,& yes,
348 s,^ClamukoScanOnExec$,& yes,
352 %banner -e %{name}-0.90 <<EOF
353 ClamAV config was automatically upgraded to 0.90 format. You should review it
354 that it's still valid.
357 # unfortunately clamd has no configcheck option so we just have to start it
358 # once again after config was broken after upgrade
359 touch /var/lock/subsys/clamd
360 %service -q clamd restart
362 %systemd_trigger clamd.service
364 %systemd_service_enable cronjob-clamav.timer
367 /sbin/chkconfig --add clamav-milter
368 %service clamav-milter restart "Clam Antivirus daemon"
371 if [ "$1" = "0" ]; then
372 %service clamav-milter stop
373 /sbin/chkconfig --del clamav-milter
376 %post libs -p /sbin/ldconfig
377 %postun libs -p /sbin/ldconfig
380 %defattr(644,root,root,755)
381 %doc ChangeLog.md NEWS.md README.md
382 %attr(755,root,root) %{_bindir}/clambc
383 %attr(755,root,root) %{_bindir}/clamdscan
384 %attr(755,root,root) %{_bindir}/clamdtop
385 %attr(755,root,root) %{_bindir}/clamscan
386 %attr(755,root,root) %{_bindir}/clamsubmit
387 %attr(755,root,root) %{_bindir}/freshclam
388 %attr(755,root,root) %{_bindir}/sigtool
389 %attr(755,root,root) %{_bindir}/clamconf
390 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
391 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
392 %attr(755,root,root) %{_sbindir}/clamd
393 %attr(755,root,root) %{_sbindir}/clamonacc
394 %{systemdtmpfilesdir}/%{name}.conf
395 %{systemdunitdir}/clamav-clamonacc.service
396 %{systemdunitdir}/clamav-daemon.service
397 %{systemdunitdir}/clamav-daemon.socket
398 %{systemdunitdir}/clamav-freshclam.service
399 %{systemdunitdir}/clamd.service
400 %{systemdunitdir}/cronjob-clamav.service
401 %{systemdunitdir}/cronjob-clamav.timer
402 %attr(755,clamav,root) %dir /var/lib/%{name}
403 %attr(640,clamav,root) %ghost /var/log/freshclam.log
404 %attr(750,clamav,clamav) %dir /var/run/%{name}
406 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
407 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
408 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
410 %attr(754,root,root) /etc/rc.d/init.d/clamd
411 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
412 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
413 %{_mandir}/man1/clambc.1*
414 %{_mandir}/man1/clamconf.1*
415 %{_mandir}/man1/clamdscan.1*
416 %{_mandir}/man1/clamdtop.1*
417 %{_mandir}/man1/clamscan.1*
418 %{_mandir}/man1/clamsubmit.1*
419 %{_mandir}/man1/freshclam.1*
420 %{_mandir}/man1/sigtool.1*
421 %{_mandir}/man5/clamd.conf.5*
422 %{_mandir}/man5/freshclam.conf.5*
423 %{_mandir}/man8/clamd.8*
424 %{_mandir}/man8/clamonacc.8*
428 %defattr(644,root,root,755)
429 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
430 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
431 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
432 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
433 %attr(755,root,root) %{_sbindir}/clamav-milter
434 %{_mandir}/man5/clamav-milter.conf.5*
435 %{_mandir}/man8/clamav-milter.8*
436 %attr(700,clamav,clamav) /var/spool/clamav
440 %defattr(644,root,root,755)
441 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
442 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
443 %if %{without system_libmspack}
444 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
445 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
447 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
448 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
449 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
450 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
451 %attr(755,root,root) %{_libdir}/libfreshclam.so.*.*.*
452 %attr(755,root,root) %ghost %{_libdir}/libfreshclam.so.2
455 %defattr(644,root,root,755)
456 %attr(755,root,root) %{_bindir}/clamav-config
457 %attr(755,root,root) %{_libdir}/libclamav.so
458 %if %{without system_libmspack}
459 %attr(755,root,root) %{_libdir}/libclammspack.so
461 %attr(755,root,root) %{_libdir}/libclamunrar.so
462 %attr(755,root,root) %{_libdir}/libfreshclam.so
463 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
464 %{_libdir}/libclamav.la
465 %if %{without system_libmspack}
466 %{_libdir}/libclammspack.la
468 %{_libdir}/libclamunrar.la
469 %{_libdir}/libfreshclam.la
470 %{_libdir}/libclamunrar_iface.la
471 %dir %{_includedir}/clamav
472 %{_includedir}/clamav/clamav.h
473 %{_includedir}/clamav/clamav-types.h
474 %{_includedir}/clamav/clamav-version.h
475 %{_includedir}/clamav/libfreshclam.h
476 %{_pkgconfigdir}/libclamav.pc
479 %defattr(644,root,root,755)
480 %{_libdir}/libclamav.a
481 %if %{without system_libmspack}
482 %{_libdir}/libclammspack.a
484 %{_libdir}/libclamunrar.a
485 %{_libdir}/libfreshclam.a
486 %{_libdir}/libclamunrar_iface.a