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: 3f4789c09f5a35e9ea580edd5c3e54b6
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
43 Patch5: %{name}-add-support-for-system-tomsfastmath.patch
44 URL: http://www.clamav.net/
45 BuildRequires: bzip2-devel >= 1.0.5
46 BuildRequires: cmake >= 3.14
47 BuildRequires: check-devel
48 BuildRequires: curl-devel >= 7.40
49 BuildRequires: gmp-devel
50 BuildRequires: json-c-devel
51 BuildRequires: libltdl-devel
52 %{?with_milter:BuildRequires: libmilter-devel}
53 %{?with_system_libmspack:BuildRequires: libmspack-devel}
54 BuildRequires: libstdc++-devel >= 5:3.4
55 %{?with_milter:BuildRequires: libwrap-devel}
56 BuildRequires: libxml2-devel >= 2
57 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
58 BuildRequires: ncurses-devel
59 BuildRequires: openssl-devel >= 0.9.8
60 BuildRequires: pcre2-8-devel >= 10.30
61 BuildRequires: pkgconfig >= 1:0.16
62 BuildRequires: rpm-build >= 4.6
63 BuildRequires: rpmbuild(macros) >= 1.742
64 BuildRequires: systemd-devel
65 BuildRequires: tomsfastmath-devel >= 0.13.1-2
66 BuildRequires: zlib-devel >= 1.2.2
67 Requires(post,preun): /sbin/chkconfig
68 Requires(postun): /usr/sbin/groupdel
69 Requires(postun): /usr/sbin/userdel
70 Requires(postun,pre): /usr/sbin/usermod
71 Requires(pre): /bin/id
72 Requires(pre): /usr/bin/getgid
73 Requires(pre): /usr/sbin/groupadd
74 Requires(pre): /usr/sbin/useradd
75 Requires(post,preun,postun): systemd-units >= 38
76 Requires: systemd-units >= 38
77 Requires(postun): sed >= 4.0
78 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
79 Requires: /usr/sbin/usermod
80 Requires: rc-scripts >= 0.4.1.23
81 Suggests: clamav-database
83 Provides: group(clamav)
84 Provides: user(clamav)
85 Conflicts: logrotate < 3.7-4
86 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
89 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
90 especially for e-mail scanning on mail gateways. It provides a number
91 of utilities including a flexible and scalable multi-threaded daemon,
92 a command line scanner and advanced tool for automatic database
93 updates. The core of the package is an anti-virus engine available in
94 a form of shared library (available in clamav-libs).
96 Here is a list of the main features:
97 - command-line scanner
98 - fast, multi-threaded daemon with support for on-access scanning
99 - milter interface for sendmail
100 - advanced database updater with support for scripted updates and
102 - virus scanner C library
103 - on-access scanning (Linux and FreeBSD)
104 - virus database updated multiple times per day (see home page for
105 total number of signatures)
106 - built-in support for various archive formats, including Zip, RAR,
107 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
108 - built-in support for almost all mail file formats
109 - built-in support for ELF executables and Portable Executable files
110 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
111 obfuscated with SUE, Y0da Cryptor and others
112 - built-in support for popular document formats including MS Office
113 and MacOffice files, HTML, RTF and PDF
115 %description -l pl.UTF-8
116 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
117 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
118 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
119 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
120 skaner działający z linii poleceń oraz zaawansowane narzędzie do
121 automatycznej aktualizacji bazy danych. Główna część pakietu to
122 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
123 (dostępnej w pakiecie clamav-libs).
125 Lista podstawowych możliwości:
126 - skaner działający z linii poleceń
127 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
128 - interfejs milter dla sendmaila
129 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
130 aktualizacji oskryptowanych oraz podpisów cyfrowych
131 - biblioteka C skanera antywirusowego
132 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
133 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
134 sygnatur dostępna na stronie projektu)
135 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
136 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
137 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
138 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
139 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
140 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
141 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
142 Office, MacOffice, HTML, RTF i PDF
145 Summary: Shared libraries for clamav
146 Summary(pl.UTF-8): Biblioteki dzielone clamav
148 Requires: bzip2-libs >= 1.0.5
149 Requires: curl-libs >= 7.40
150 Requires: pcre2-8 >= 10.30
151 Requires: zlib >= 1.2.2
154 Shared libraries for clamav.
156 %description libs -l pl.UTF-8
157 Biblioteki dzielone clamav.
160 Summary: ClamAV filter using milter interface
161 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
163 Requires: %{name} = %{epoch}:%{version}-%{release}
165 #Requires: sendmail >= 8.11
166 Requires: tcp_wrappers
169 ClamAV sendmail filter using MILTER interface.
171 %description milter -l pl.UTF-8
172 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
175 Summary: clamav - Development header files and libraries
176 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
177 Group: Development/Libraries
178 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
179 Requires: bzip2-devel >= 1.0.5
180 Requires: curl-devel >= 7.40
182 Requires: openssl-devel >= 0.9.8
183 Requires: pcre2-8-devel >= 10.30
184 Requires: zlib-devel >= 1.2.2
187 This package contains the development header files and libraries
188 necessary to develop clamav client applications.
190 %description devel -l pl.UTF-8
191 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
195 Summary: clamav static libraries
196 Summary(pl.UTF-8): Biblioteki statyczne clamav
197 Group: Development/Libraries
198 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
201 clamav static libraries.
203 %description static -l pl.UTF-8
204 Biblioteki statyczne clamav.
207 Summary: ClamAV documentation
208 Summary(pl.UTF-8): Dokumentacja do ClamAVa
213 ClamAV documentation.
215 %description doc -l pl.UTF-8
216 Dokumentacja do ClamAVa.
229 %{cmake_on_off system_libmspack ENABLE_EXTERNAL_MSPACK} \
230 %{cmake_on_off milter ENABLE_MILTER} \
231 %{cmake_on_off static_libs ENABLE_STATIC_LIB} \
233 -DENABLE_CLAMONACC=ON \
234 -DENABLE_FRESHCLAM_NO_CACHE=ON \
235 -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/%{name} \
236 -DAPP_CONFIG_DIRECTORY=%{_sysconfdir} \
237 -DDATABASE_DIRECTORY="/var/lib/%{name}" \
242 rm -rf $RPM_BUILD_ROOT
243 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
244 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
245 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
246 $RPM_BUILD_ROOT%{systemdunitdir}
248 %{__make} -C build install \
249 DESTDIR=$RPM_BUILD_ROOT
251 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
253 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/html
255 %if %{with static_libs}
256 %{__mv} $RPM_BUILD_ROOT%{_libdir}/libclamav{_static,}.a
257 %{__mv} $RPM_BUILD_ROOT%{_libdir}/libfreshclam{_static,}.a
260 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
261 5 * * * * root %{_sbindir}/clamav-cron-updatedb
264 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
266 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
267 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
269 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
270 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
271 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
274 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
276 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
278 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
280 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
281 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
282 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
284 # NOTE: clamd uses sane rights to it's clamd.pid file
285 # So better keep it dir
286 # If it is fixed use of dir will be unecesary
287 install -d $RPM_BUILD_ROOT/var/run/%{name}
289 :> $RPM_BUILD_ROOT/var/log/freshclam.log
292 rm -rf $RPM_BUILD_ROOT
294 %triggerin -- amavis-ng
295 %addusertogroup -q clamav amavis
297 %triggerin -- amavisd-new
298 %addusertogroup -q clamav amavis
300 %triggerin -- amavisd
301 %addusertogroup -q clamav amavis
304 %groupadd -g 43 clamav
305 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
308 /sbin/chkconfig --add clamd
309 %service clamd restart "Clam Antivirus daemon"
310 touch /var/log/freshclam.log
311 chown clamav:root /var/log/freshclam.log
312 chmod 640 /var/log/freshclam.log
313 %systemd_post clamd.service cronjob-clamav.timer
316 if [ "$1" = "0" ]; then
318 /sbin/chkconfig --del clamd
320 %systemd_preun clamd.service cronjob-clamav.timer
323 if [ "$1" = "0" ]; then
329 %triggerpostun -- %{name} < 0.99.2-2
330 if [ -f /etc/clamav.conf.rpmsave ]; then
331 echo "Renaming config to new name /etc/clamd.conf"
332 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
333 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
334 echo "Changing config location in freshclam config"
335 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
338 %{__cp} -f /etc/clamd.conf{,.rpmsave}
341 s,^FixStaleSocket$,& yes,
342 s,^AllowSupplementaryGroups$,& yes,
343 s,^ClamukoScanOnOpen$,& yes,
344 s,^ClamukoScanOnClose$,& yes,
345 s,^ClamukoScanOnExec$,& yes,
349 %banner -e %{name}-0.90 <<EOF
350 ClamAV config was automatically upgraded to 0.90 format. You should review it
351 that it's still valid.
354 # unfortunately clamd has no configcheck option so we just have to start it
355 # once again after config was broken after upgrade
356 touch /var/lock/subsys/clamd
357 %service -q clamd restart
359 %systemd_trigger clamd.service
361 %systemd_service_enable cronjob-clamav.timer
364 /sbin/chkconfig --add clamav-milter
365 %service clamav-milter restart "Clam Antivirus daemon"
368 if [ "$1" = "0" ]; then
369 %service clamav-milter stop
370 /sbin/chkconfig --del clamav-milter
373 %post libs -p /sbin/ldconfig
374 %postun libs -p /sbin/ldconfig
377 %defattr(644,root,root,755)
378 %doc ChangeLog.md NEWS.md README.md
379 %attr(755,root,root) %{_bindir}/clambc
380 %attr(755,root,root) %{_bindir}/clamdscan
381 %attr(755,root,root) %{_bindir}/clamdtop
382 %attr(755,root,root) %{_bindir}/clamscan
383 %attr(755,root,root) %{_bindir}/clamsubmit
384 %attr(755,root,root) %{_bindir}/freshclam
385 %attr(755,root,root) %{_bindir}/sigtool
386 %attr(755,root,root) %{_bindir}/clamconf
387 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
388 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
389 %attr(755,root,root) %{_sbindir}/clamd
390 %attr(755,root,root) %{_sbindir}/clamonacc
391 %{systemdtmpfilesdir}/%{name}.conf
392 %{systemdunitdir}/clamav-clamonacc.service
393 %{systemdunitdir}/clamav-daemon.service
394 %{systemdunitdir}/clamav-daemon.socket
395 %{systemdunitdir}/clamav-freshclam.service
396 %{systemdunitdir}/clamd.service
397 %{systemdunitdir}/cronjob-clamav.service
398 %{systemdunitdir}/cronjob-clamav.timer
399 %attr(755,clamav,root) %dir /var/lib/%{name}
400 %attr(640,clamav,root) %ghost /var/log/freshclam.log
401 %attr(750,clamav,clamav) %dir /var/run/%{name}
403 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
404 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
405 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
407 %attr(754,root,root) /etc/rc.d/init.d/clamd
408 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
409 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
410 %{_mandir}/man1/clambc.1*
411 %{_mandir}/man1/clamconf.1*
412 %{_mandir}/man1/clamdscan.1*
413 %{_mandir}/man1/clamdtop.1*
414 %{_mandir}/man1/clamscan.1*
415 %{_mandir}/man1/clamsubmit.1*
416 %{_mandir}/man1/freshclam.1*
417 %{_mandir}/man1/sigtool.1*
418 %{_mandir}/man5/clamd.conf.5*
419 %{_mandir}/man5/freshclam.conf.5*
420 %{_mandir}/man8/clamd.8*
421 %{_mandir}/man8/clamonacc.8*
425 %defattr(644,root,root,755)
426 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
427 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
428 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
429 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
430 %attr(755,root,root) %{_sbindir}/clamav-milter
431 %{_mandir}/man5/clamav-milter.conf.5*
432 %{_mandir}/man8/clamav-milter.8*
433 %attr(700,clamav,clamav) /var/spool/clamav
437 %defattr(644,root,root,755)
438 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
439 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
440 %if %{without system_libmspack}
441 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
442 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
444 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
445 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
446 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
447 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
448 %attr(755,root,root) %{_libdir}/libfreshclam.so.*.*.*
449 %attr(755,root,root) %ghost %{_libdir}/libfreshclam.so.2
452 %defattr(644,root,root,755)
453 %attr(755,root,root) %{_bindir}/clamav-config
454 %attr(755,root,root) %{_libdir}/libclamav.so
455 %if %{without system_libmspack}
456 %attr(755,root,root) %{_libdir}/libclammspack.so
458 %attr(755,root,root) %{_libdir}/libclamunrar.so
459 %attr(755,root,root) %{_libdir}/libfreshclam.so
460 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
461 %dir %{_includedir}/clamav
462 %{_includedir}/clamav/clamav.h
463 %{_includedir}/clamav/clamav-types.h
464 %{_includedir}/clamav/clamav-version.h
465 %{_includedir}/clamav/libfreshclam.h
466 %{_pkgconfigdir}/libclamav.pc
469 %defattr(644,root,root,755)
470 %{_libdir}/libclamav.a
471 %if %{without system_libmspack}
472 %{_libdir}/libclammspack.a
474 %{_libdir}/libfreshclam.a
477 %defattr(644,root,root,755)