2 # - Make freshclam package (script and daemon)
3 # - restart amavis in triggers if group membership was modified?
5 # ClamAV requires non-default build options for TomsFastMath to support bigger
6 # floating point numbers. Without this change, database and Windows EXE/DLL
7 # authenticode certificate validation may fail. Don't use system one.
10 %bcond_without milter # milter interface subpackage
11 %if "%{pld_release}" == "ac"
12 %bcond_with llvm # LLVM support
14 %bcond_without llvm # LLVM support
16 %bcond_without system_libmspack # system libmspack library
17 %bcond_with system_llvm # system LLVM (< 3.7)
18 %bcond_without static_libs # static libraries
23 Summary: An anti-virus utility for Unix
24 Summary(pl.UTF-8): Narzędzie antywirusowe dla Uniksów
30 #Source0Download: http://www.clamav.net/download
31 Source0: http://www.clamav.net/downloads/production/%{name}-%{version}.tar.gz
32 # Source0-md5: c70168adc7c88506e079ac86a0c57031
34 Source2: %{name}.sysconfig
35 Source3: %{name}-milter.init
36 Source4: %{name}-cron-updatedb
37 Source5: %{name}.logrotate
38 Source8: %{name}-post-updatedb
39 Source9: %{name}-milter.sysconfig
40 Source10: %{name}.tmpfiles
41 Source11: clamd.service
42 Source12: cronjob-clamav.timer
43 Source13: cronjob-clamav.service.in
44 Patch0: %{name}-pld_config.patch
45 URL: http://www.clamav.net/
46 BuildRequires: bzip2-devel >= 1.0.5
48 BuildRequires: cmake >= 3.14
49 BuildRequires: check-devel
50 BuildRequires: curl-devel >= 7.40
51 BuildRequires: gmp-devel
52 BuildRequires: json-c-devel
53 BuildRequires: libltdl-devel
54 %{?with_milter:BuildRequires: libmilter-devel}
55 %{?with_system_libmspack:BuildRequires: libmspack-devel}
56 BuildRequires: libstdc++-devel >= 5:3.4
57 %{?with_milter:BuildRequires: libwrap-devel}
58 BuildRequires: libxml2-devel >= 2
59 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
60 BuildRequires: ncurses-devel
61 BuildRequires: openssl-devel >= 0.9.8
62 BuildRequires: pcre2-8-devel >= 10.30
63 BuildRequires: pkgconfig >= 1:0.16
64 BuildRequires: rpm-build >= 4.6
65 BuildRequires: rpmbuild(macros) >= 1.742
66 BuildRequires: rust >= 1.56
67 BuildRequires: systemd-devel
68 BuildRequires: zlib-devel >= 1.2.2
69 Requires(post,preun): /sbin/chkconfig
70 Requires(postun): /usr/sbin/groupdel
71 Requires(postun): /usr/sbin/userdel
72 Requires(postun,pre): /usr/sbin/usermod
73 Requires(pre): /bin/id
74 Requires(pre): /usr/bin/getgid
75 Requires(pre): /usr/sbin/groupadd
76 Requires(pre): /usr/sbin/useradd
77 Requires(post,preun,postun): systemd-units >= 38
78 Requires: systemd-units >= 38
79 Requires(postun): sed >= 4.0
80 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
81 Requires: /usr/sbin/usermod
82 Requires: rc-scripts >= 0.4.1.23
83 Suggests: clamav-database
85 Provides: group(clamav)
86 Provides: user(clamav)
87 Conflicts: logrotate < 3.7-4
88 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
91 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
92 especially for e-mail scanning on mail gateways. It provides a number
93 of utilities including a flexible and scalable multi-threaded daemon,
94 a command line scanner and advanced tool for automatic database
95 updates. The core of the package is an anti-virus engine available in
96 a form of shared library (available in clamav-libs).
98 Here is a list of the main features:
99 - command-line scanner
100 - fast, multi-threaded daemon with support for on-access scanning
101 - milter interface for sendmail
102 - advanced database updater with support for scripted updates and
104 - virus scanner C library
105 - on-access scanning (Linux and FreeBSD)
106 - virus database updated multiple times per day (see home page for
107 total number of signatures)
108 - built-in support for various archive formats, including Zip, RAR,
109 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
110 - built-in support for almost all mail file formats
111 - built-in support for ELF executables and Portable Executable files
112 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
113 obfuscated with SUE, Y0da Cryptor and others
114 - built-in support for popular document formats including MS Office
115 and MacOffice files, HTML, RTF and PDF
117 %description -l pl.UTF-8
118 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
119 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
120 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
121 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
122 skaner działający z linii poleceń oraz zaawansowane narzędzie do
123 automatycznej aktualizacji bazy danych. Główna część pakietu to
124 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
125 (dostępnej w pakiecie clamav-libs).
127 Lista podstawowych możliwości:
128 - skaner działający z linii poleceń
129 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
130 - interfejs milter dla sendmaila
131 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
132 aktualizacji oskryptowanych oraz podpisów cyfrowych
133 - biblioteka C skanera antywirusowego
134 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
135 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
136 sygnatur dostępna na stronie projektu)
137 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
138 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
139 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
140 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
141 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
142 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
143 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
144 Office, MacOffice, HTML, RTF i PDF
147 Summary: Shared libraries for clamav
148 Summary(pl.UTF-8): Biblioteki dzielone clamav
150 Requires: bzip2-libs >= 1.0.5
151 Requires: curl-libs >= 7.40
152 Requires: pcre2-8 >= 10.30
153 Requires: zlib >= 1.2.2
156 Shared libraries for clamav.
158 %description libs -l pl.UTF-8
159 Biblioteki dzielone clamav.
162 Summary: ClamAV filter using milter interface
163 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
165 Requires: %{name} = %{epoch}:%{version}-%{release}
167 #Requires: sendmail >= 8.11
168 Requires: tcp_wrappers
171 ClamAV sendmail filter using MILTER interface.
173 %description milter -l pl.UTF-8
174 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
177 Summary: clamav - Development header files and libraries
178 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
179 Group: Development/Libraries
180 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
181 Requires: bzip2-devel >= 1.0.5
182 Requires: curl-devel >= 7.40
184 Requires: openssl-devel >= 0.9.8
185 Requires: pcre2-8-devel >= 10.30
186 Requires: zlib-devel >= 1.2.2
189 This package contains the development header files and libraries
190 necessary to develop clamav client applications.
192 %description devel -l pl.UTF-8
193 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
197 Summary: clamav static libraries
198 Summary(pl.UTF-8): Biblioteki statyczne clamav
199 Group: Development/Libraries
200 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
203 clamav static libraries.
205 %description static -l pl.UTF-8
206 Biblioteki statyczne clamav.
209 Summary: ClamAV documentation
210 Summary(pl.UTF-8): Dokumentacja do ClamAVa
215 ClamAV documentation.
217 %description doc -l pl.UTF-8
218 Dokumentacja do ClamAVa.
228 %{cmake_on_off system_libmspack ENABLE_EXTERNAL_MSPACK} \
229 %{cmake_on_off milter ENABLE_MILTER} \
230 %{cmake_on_off static_libs ENABLE_STATIC_LIB} \
232 -DENABLE_CLAMONACC=ON \
233 -DENABLE_FRESHCLAM_NO_CACHE=ON \
234 -DRUST_COMPILER_TARGET=%{rust_target} \
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 cronjob-clamav.timer
362 /sbin/chkconfig --add clamav-milter
363 %service clamav-milter restart "Clam Antivirus daemon"
366 if [ "$1" = "0" ]; then
367 %service clamav-milter stop
368 /sbin/chkconfig --del clamav-milter
371 %post libs -p /sbin/ldconfig
372 %postun libs -p /sbin/ldconfig
375 %defattr(644,root,root,755)
376 %doc ChangeLog.md NEWS.md README.md
377 %attr(755,root,root) %{_bindir}/clambc
378 %attr(755,root,root) %{_bindir}/clamdscan
379 %attr(755,root,root) %{_bindir}/clamdtop
380 %attr(755,root,root) %{_bindir}/clamscan
381 %attr(755,root,root) %{_bindir}/clamsubmit
382 %attr(755,root,root) %{_bindir}/freshclam
383 %attr(755,root,root) %{_bindir}/sigtool
384 %attr(755,root,root) %{_bindir}/clamconf
385 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
386 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
387 %attr(755,root,root) %{_sbindir}/clamd
388 %attr(755,root,root) %{_sbindir}/clamonacc
389 %{systemdtmpfilesdir}/%{name}.conf
390 %{systemdunitdir}/clamav-clamonacc.service
391 %{systemdunitdir}/clamav-daemon.service
392 %{systemdunitdir}/clamav-daemon.socket
393 %{systemdunitdir}/clamav-freshclam.service
394 %{systemdunitdir}/clamd.service
395 %{systemdunitdir}/cronjob-clamav.service
396 %{systemdunitdir}/cronjob-clamav.timer
397 %attr(755,clamav,root) %dir /var/lib/%{name}
398 %attr(640,clamav,root) %ghost /var/log/freshclam.log
399 %attr(750,clamav,clamav) %dir /var/run/%{name}
401 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
402 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
403 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
405 %attr(754,root,root) /etc/rc.d/init.d/clamd
406 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
407 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
408 %{_mandir}/man1/clambc.1*
409 %{_mandir}/man1/clamconf.1*
410 %{_mandir}/man1/clamdscan.1*
411 %{_mandir}/man1/clamdtop.1*
412 %{_mandir}/man1/clamscan.1*
413 %{_mandir}/man1/clamsubmit.1*
414 %{_mandir}/man1/freshclam.1*
415 %{_mandir}/man1/sigtool.1*
416 %{_mandir}/man5/clamd.conf.5*
417 %{_mandir}/man5/freshclam.conf.5*
418 %{_mandir}/man8/clamd.8*
419 %{_mandir}/man8/clamonacc.8*
423 %defattr(644,root,root,755)
424 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
425 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
426 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
427 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
428 %attr(755,root,root) %{_sbindir}/clamav-milter
429 %{_mandir}/man5/clamav-milter.conf.5*
430 %{_mandir}/man8/clamav-milter.8*
431 %attr(700,clamav,clamav) /var/spool/clamav
435 %defattr(644,root,root,755)
436 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
437 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.12
438 %if %{without system_libmspack}
439 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
440 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
442 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
443 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.12
444 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
445 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.12
446 %attr(755,root,root) %{_libdir}/libfreshclam.so.*.*.*
447 %attr(755,root,root) %ghost %{_libdir}/libfreshclam.so.3
450 %defattr(644,root,root,755)
451 %attr(755,root,root) %{_bindir}/clamav-config
452 %attr(755,root,root) %{_libdir}/libclamav.so
453 %if %{without system_libmspack}
454 %attr(755,root,root) %{_libdir}/libclammspack.so
456 %attr(755,root,root) %{_libdir}/libclamunrar.so
457 %attr(755,root,root) %{_libdir}/libfreshclam.so
458 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
459 %dir %{_includedir}/clamav
460 %{_includedir}/clamav/clamav.h
461 %{_includedir}/clamav/clamav-types.h
462 %{_includedir}/clamav/clamav-version.h
463 %{_includedir}/clamav/libfreshclam.h
464 %{_pkgconfigdir}/libclamav.pc
467 %defattr(644,root,root,755)
468 %{_libdir}/libclamav.a
469 %if %{without system_libmspack}
470 %{_libdir}/libclammspack.a
472 %{_libdir}/libfreshclam.a
475 %defattr(644,root,root,755)