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)
18 Summary: An anti-virus utility for Unix
19 Summary(pl.UTF-8): Narzędzie antywirusowe dla Uniksów
25 #Source0Download: http://www.clamav.net/download
26 Source0: http://www.clamav.net/downloads/production/%{name}-%{version}.tar.gz
27 # Source0-md5: 9c137d6172f6e132e08e61fe25b636f8
29 Source2: %{name}.sysconfig
30 Source3: %{name}-milter.init
31 Source4: %{name}-cron-updatedb
32 Source5: %{name}.logrotate
33 Source8: %{name}-post-updatedb
34 Source9: %{name}-milter.sysconfig
35 Source10: %{name}.tmpfiles
36 Source11: clamd.service
37 Source12: cronjob-clamav.timer
38 Source13: cronjob-clamav.service.in
39 Patch0: %{name}-pld_config.patch
40 Patch1: %{name}-nolibs.patch
41 %if "%{pld_release}" == "ac"
42 Patch2: am-nosilentrules.patch
45 Patch4: %{name}-openssl.patch
46 Patch5: %{name}-major.patch
48 Patch7: %{name}-add-support-for-system-tomsfastmath.patch
49 Patch8: %{name}-headers.patch
50 URL: http://www.clamav.net/
51 BuildRequires: autoconf >= 2.59
52 BuildRequires: automake >= 1:1.11
53 BuildRequires: bzip2-devel
54 BuildRequires: check-devel
55 BuildRequires: curl-devel
56 BuildRequires: gmp-devel
57 BuildRequires: json-c-devel
58 BuildRequires: libltdl-devel
59 %{?with_milter:BuildRequires: libmilter-devel}
60 %{?with_system_libmspack:BuildRequires: libmspack-devel}
61 BuildRequires: libstdc++-devel >= 5:3.4
62 BuildRequires: libtool
63 %{?with_milter:BuildRequires: libwrap-devel}
64 BuildRequires: libxml2-devel >= 2
65 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
66 BuildRequires: ncurses-devel
67 BuildRequires: openssl-devel >= 0.9.8
68 BuildRequires: pcre2-8-devel
69 BuildRequires: pkgconfig >= 1:0.16
70 BuildRequires: rpm >= 4.4.9-56
71 BuildRequires: rpmbuild(macros) >= 1.647
72 BuildRequires: systemd-devel
73 BuildRequires: tomsfastmath-devel >= 0.13.1-2
74 BuildRequires: zlib-devel >= 1.2.2
75 Requires(post,preun): /sbin/chkconfig
76 Requires(postun): /usr/sbin/groupdel
77 Requires(postun): /usr/sbin/userdel
78 Requires(postun,pre): /usr/sbin/usermod
79 Requires(pre): /bin/id
80 Requires(pre): /usr/bin/getgid
81 Requires(pre): /usr/sbin/groupadd
82 Requires(pre): /usr/sbin/useradd
83 Requires(post,preun,postun): systemd-units >= 38
84 Requires: systemd-units >= 38
85 Requires(triggerpostun): sed >= 4.0
86 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
87 Requires: /usr/sbin/usermod
88 Requires: rc-scripts >= 0.4.1.23
89 Suggests: clamav-database
91 Provides: group(clamav)
92 Provides: user(clamav)
93 Conflicts: logrotate < 3.7-4
94 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
97 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
98 especially for e-mail scanning on mail gateways. It provides a number
99 of utilities including a flexible and scalable multi-threaded daemon,
100 a command line scanner and advanced tool for automatic database
101 updates. The core of the package is an anti-virus engine available in
102 a form of shared library (available in clamav-libs).
104 Here is a list of the main features:
105 - command-line scanner
106 - fast, multi-threaded daemon with support for on-access scanning
107 - milter interface for sendmail
108 - advanced database updater with support for scripted updates and
110 - virus scanner C library
111 - on-access scanning (Linux and FreeBSD)
112 - virus database updated multiple times per day (see home page for
113 total number of signatures)
114 - built-in support for various archive formats, including Zip, RAR,
115 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
116 - built-in support for almost all mail file formats
117 - built-in support for ELF executables and Portable Executable files
118 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
119 obfuscated with SUE, Y0da Cryptor and others
120 - built-in support for popular document formats including MS Office
121 and MacOffice files, HTML, RTF and PDF
123 %description -l pl.UTF-8
124 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
125 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
126 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
127 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
128 skaner działający z linii poleceń oraz zaawansowane narzędzie do
129 automatycznej aktualizacji bazy danych. Główna część pakietu to
130 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
131 (dostępnej w pakiecie clamav-libs).
133 Lista podstawowych możliwości:
134 - skaner działający z linii poleceń
135 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
136 - interfejs milter dla sendmaila
137 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
138 aktualizacji oskryptowanych oraz podpisów cyfrowych
139 - biblioteka C skanera antywirusowego
140 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
141 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
142 sygnatur dostępna na stronie projektu)
143 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
144 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
145 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
146 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
147 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
148 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
149 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
150 Office, MacOffice, HTML, RTF i PDF
153 Summary: Shared libraries for clamav
154 Summary(pl.UTF-8): Biblioteki dzielone clamav
156 Requires: zlib >= 1.2.2
159 Shared libraries for clamav.
161 %description libs -l pl.UTF-8
162 Biblioteki dzielone clamav.
165 Summary: ClamAV filter using milter interface
166 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
168 Requires: %{name} = %{epoch}:%{version}-%{release}
170 #Requires: sendmail >= 8.11
171 Requires: tcp_wrappers
174 ClamAV sendmail filter using MILTER interface.
176 %description milter -l pl.UTF-8
177 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
180 Summary: clamav - Development header files and libraries
181 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
182 Group: Development/Libraries
183 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
184 Requires: bzip2-devel
187 Requires: openssl-devel >= 0.9.8
188 Requires: zlib-devel >= 1.2.2
191 This package contains the development header files and libraries
192 necessary to develop clamav client applications.
194 %description devel -l pl.UTF-8
195 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
199 Summary: clamav static libraries
200 Summary(pl.UTF-8): Biblioteki statyczne clamav
201 Group: Development/Libraries
202 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
205 clamav static libraries.
207 %description static -l pl.UTF-8
208 Biblioteki statyczne clamav.
214 %if "%{pld_release}" == "ac"
217 %if "%{pld_release}" != "ac"
227 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
228 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
237 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
238 %{?with_milter:--enable-milter} \
239 --disable-silent-rules \
240 --disable-zlib-vcheck \
241 --with-dbdir=/var/lib/%{name} \
242 --with-ltdl-include=%{_includedir} \
243 --with-ltdl-lib=%{_libdir} \
245 %{?with_system_libmspack:--with-system-libmspack}
248 LIBTOOL=%{_bindir}/libtool
251 rm -rf $RPM_BUILD_ROOT
252 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
253 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
254 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
255 $RPM_BUILD_ROOT%{systemdunitdir}
258 LIBTOOL=%{_bindir}/libtool \
259 DESTDIR=$RPM_BUILD_ROOT
260 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
262 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
263 5 * * * * root %{_sbindir}/clamav-cron-updatedb
266 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
268 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
269 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
271 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
272 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
273 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
276 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
278 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
280 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
282 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
283 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
284 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
286 # NOTE: clamd uses sane rights to it's clamd.pid file
287 # So better keep it dir
288 # If it is fixed use of dir will be unecesary
289 install -d $RPM_BUILD_ROOT/var/run/%{name}
291 :> $RPM_BUILD_ROOT/var/log/freshclam.log
294 rm -rf $RPM_BUILD_ROOT
296 %triggerin -- amavis-ng
297 %addusertogroup -q clamav amavis
299 %triggerin -- amavisd-new
300 %addusertogroup -q clamav amavis
302 %triggerin -- amavisd
303 %addusertogroup -q clamav amavis
306 %groupadd -g 43 clamav
307 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
310 /sbin/chkconfig --add clamd
311 %service clamd restart "Clam Antivirus daemon"
312 touch /var/log/freshclam.log
313 chown clamav:root /var/log/freshclam.log
314 chmod 640 /var/log/freshclam.log
315 %systemd_post clamd.service cronjob-clamav.timer
318 if [ "$1" = "0" ]; then
320 /sbin/chkconfig --del clamd
322 %systemd_preun clamd.service cronjob-clamav.timer
325 if [ "$1" = "0" ]; then
331 %triggerpostun -- %{name} < 0.80
332 if [ -f /etc/clamav.conf.rpmsave ]; then
333 echo "Renaming config to new name /etc/clamd.conf"
334 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
335 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
336 echo "Changing config location in freshclam config"
337 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
340 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
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 %triggerpostun -- %{name} < 0.97.7-4
363 %systemd_trigger clamd.service
365 %triggerpostun -- %{name} < 0.99.2-2
366 %systemd_service_enable cronjob-clamav.timer
369 /sbin/chkconfig --add clamav-milter
370 %service clamav-milter restart "Clam Antivirus daemon"
373 if [ "$1" = "0" ]; then
374 %service clamav-milter stop
375 /sbin/chkconfig --del clamav-milter
378 %post libs -p /sbin/ldconfig
379 %postun libs -p /sbin/ldconfig
382 %defattr(644,root,root,755)
383 %doc ChangeLog.md NEWS.md README.md
384 %attr(755,root,root) %{_bindir}/clambc
385 %attr(755,root,root) %{_bindir}/clamdscan
386 %attr(755,root,root) %{_bindir}/clamdtop
387 %attr(755,root,root) %{_bindir}/clamscan
388 %attr(755,root,root) %{_bindir}/clamsubmit
389 %attr(755,root,root) %{_bindir}/freshclam
390 %attr(755,root,root) %{_bindir}/sigtool
391 %attr(755,root,root) %{_bindir}/clamconf
392 %attr(755,root,root) %{_sbindir}/clamd
393 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
394 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
395 %{systemdtmpfilesdir}/%{name}.conf
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
414 %{_mandir}/man5/clamd*
415 %{_mandir}/man5/freshclam*
416 %{_mandir}/man8/clamd*
420 %defattr(644,root,root,755)
421 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
422 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
423 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
424 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
425 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
426 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
427 %attr(755,root,root) %{_sbindir}/clamav-milter
428 %{_mandir}/man5/clamav-milter*
429 %{_mandir}/man8/clamav-milter.8*
430 %attr(700,clamav,clamav) /var/spool/clamav
434 %defattr(644,root,root,755)
435 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
436 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
437 %if %{without system_libmspack}
438 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
439 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
441 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
442 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
443 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
444 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
447 %defattr(644,root,root,755)
448 %attr(755,root,root) %{_bindir}/clamav-config
449 %attr(755,root,root) %{_libdir}/libclamav.so
450 %if %{without system_libmspack}
451 %attr(755,root,root) %{_libdir}/libclammspack.so
453 %attr(755,root,root) %{_libdir}/libclamunrar.so
454 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
455 %{_libdir}/libclamav.la
456 %if %{without system_libmspack}
457 %{_libdir}/libclammspack.la
459 %{_libdir}/libclamunrar.la
460 %{_libdir}/libclamunrar_iface.la
461 %dir %{_includedir}/clamav
462 %{_includedir}/clamav/clamav.h
463 %{_includedir}/clamav/clamav-types.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}/libclamunrar.a
473 %{_libdir}/libclamunrar_iface.a