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: 47c36d13ac814b9e29ed6f5fc1691373
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 URL: http://www.clamav.net/
50 BuildRequires: autoconf >= 2.59
51 BuildRequires: automake >= 1:1.11
52 BuildRequires: bzip2-devel
53 BuildRequires: check-devel
54 BuildRequires: curl-devel
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
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
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(triggerpostun): 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: zlib >= 1.2.2
158 Shared libraries for clamav.
160 %description libs -l pl.UTF-8
161 Biblioteki dzielone clamav.
164 Summary: ClamAV filter using milter interface
165 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
167 Requires: %{name} = %{epoch}:%{version}-%{release}
169 #Requires: sendmail >= 8.11
170 Requires: tcp_wrappers
173 ClamAV sendmail filter using MILTER interface.
175 %description milter -l pl.UTF-8
176 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
179 Summary: clamav - Development header files and libraries
180 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
181 Group: Development/Libraries
182 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
183 Requires: bzip2-devel
186 Requires: openssl-devel >= 0.9.8
187 Requires: zlib-devel >= 1.2.2
190 This package contains the development header files and libraries
191 necessary to develop clamav client applications.
193 %description devel -l pl.UTF-8
194 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
198 Summary: clamav static libraries
199 Summary(pl.UTF-8): Biblioteki statyczne clamav
200 Group: Development/Libraries
201 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
204 clamav static libraries.
206 %description static -l pl.UTF-8
207 Biblioteki statyczne clamav.
213 %if "%{pld_release}" == "ac"
216 %if "%{pld_release}" != "ac"
225 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
226 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
235 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
236 %{?with_milter:--enable-milter} \
237 --disable-silent-rules \
238 --disable-zlib-vcheck \
239 --with-dbdir=/var/lib/%{name} \
240 --with-ltdl-include=%{_includedir} \
241 --with-ltdl-lib=%{_libdir} \
243 %{?with_system_libmspack:--with-system-libmspack}
246 LIBTOOL=%{_bindir}/libtool
249 rm -rf $RPM_BUILD_ROOT
250 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
251 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
252 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
253 $RPM_BUILD_ROOT%{systemdunitdir}
256 LIBTOOL=%{_bindir}/libtool \
257 DESTDIR=$RPM_BUILD_ROOT
258 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
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.80
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 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
339 %{__cp} -f /etc/clamd.conf{,.rpmsave}
342 s,^FixStaleSocket$,& yes,
343 s,^AllowSupplementaryGroups$,& yes,
344 s,^ClamukoScanOnOpen$,& yes,
345 s,^ClamukoScanOnClose$,& yes,
346 s,^ClamukoScanOnExec$,& yes,
350 %banner -e %{name}-0.90 <<EOF
351 ClamAV config was automatically upgraded to 0.90 format. You should review it
352 that it's still valid.
355 # unfortunately clamd has no configcheck option so we just have to start it
356 # once again after config was broken after upgrade
357 touch /var/lock/subsys/clamd
358 %service -q clamd restart
360 %triggerpostun -- %{name} < 0.97.7-4
361 %systemd_trigger clamd.service
363 %triggerpostun -- %{name} < 0.99.2-2
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}/clamd
391 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
392 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
393 %{systemdtmpfilesdir}/%{name}.conf
394 %{systemdunitdir}/clamav-daemon.service
395 %{systemdunitdir}/clamav-daemon.socket
396 %{systemdunitdir}/clamav-freshclam.service
397 %{systemdunitdir}/clamd.service
398 %{systemdunitdir}/cronjob-clamav.service
399 %{systemdunitdir}/cronjob-clamav.timer
400 %attr(755,clamav,root) %dir /var/lib/%{name}
401 %attr(640,clamav,root) %ghost /var/log/freshclam.log
402 %attr(750,clamav,clamav) %dir /var/run/%{name}
404 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
405 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
406 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
408 %attr(754,root,root) /etc/rc.d/init.d/clamd
409 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
410 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
412 %{_mandir}/man5/clamd*
413 %{_mandir}/man5/freshclam*
414 %{_mandir}/man8/clamd*
418 %defattr(644,root,root,755)
419 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
420 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
421 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
422 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
423 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
424 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
425 %attr(755,root,root) %{_sbindir}/clamav-milter
426 %{_mandir}/man5/clamav-milter*
427 %{_mandir}/man8/clamav-milter.8*
428 %attr(700,clamav,clamav) /var/spool/clamav
432 %defattr(644,root,root,755)
433 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
434 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
435 %if %{without system_libmspack}
436 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
437 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
439 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
440 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
441 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
442 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
445 %defattr(644,root,root,755)
446 %attr(755,root,root) %{_bindir}/clamav-config
447 %attr(755,root,root) %{_libdir}/libclamav.so
448 %if %{without system_libmspack}
449 %attr(755,root,root) %{_libdir}/libclammspack.so
451 %attr(755,root,root) %{_libdir}/libclamunrar.so
452 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
453 %{_libdir}/libclamav.la
454 %if %{without system_libmspack}
455 %{_libdir}/libclammspack.la
457 %{_libdir}/libclamunrar.la
458 %{_libdir}/libclamunrar_iface.la
459 %{_includedir}/clamav.h
460 %{_pkgconfigdir}/libclamav.pc
463 %defattr(644,root,root,755)
464 %{_libdir}/libclamav.a
465 %if %{without system_libmspack}
466 %{_libdir}/libclammspack.a
468 %{_libdir}/libclamunrar.a
469 %{_libdir}/libclamunrar_iface.a