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: ecf5dd2c5c43aeed1c4b458b2e689847
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
46 Patch5: %{name}-add-support-for-system-tomsfastmath.patch
47 Patch6: %{name}-headers.patch
48 URL: http://www.clamav.net/
49 BuildRequires: autoconf >= 2.59
50 BuildRequires: automake >= 1:1.11
51 BuildRequires: bzip2-devel
52 BuildRequires: check-devel
53 BuildRequires: curl-devel
54 BuildRequires: gmp-devel
55 BuildRequires: json-c-devel
56 BuildRequires: libltdl-devel
57 %{?with_milter:BuildRequires: libmilter-devel}
58 %{?with_system_libmspack:BuildRequires: libmspack-devel}
59 BuildRequires: libstdc++-devel >= 5:3.4
60 BuildRequires: libtool
61 %{?with_milter:BuildRequires: libwrap-devel}
62 BuildRequires: libxml2-devel >= 2
63 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
64 BuildRequires: ncurses-devel
65 BuildRequires: openssl-devel >= 0.9.8
66 BuildRequires: pcre2-8-devel
67 BuildRequires: pkgconfig >= 1:0.16
68 BuildRequires: rpm >= 4.4.9-56
69 BuildRequires: rpmbuild(macros) >= 1.647
70 BuildRequires: systemd-devel
71 BuildRequires: tomsfastmath-devel >= 0.13.1-2
72 BuildRequires: zlib-devel >= 1.2.2
73 Requires(post,preun): /sbin/chkconfig
74 Requires(postun): /usr/sbin/groupdel
75 Requires(postun): /usr/sbin/userdel
76 Requires(postun,pre): /usr/sbin/usermod
77 Requires(pre): /bin/id
78 Requires(pre): /usr/bin/getgid
79 Requires(pre): /usr/sbin/groupadd
80 Requires(pre): /usr/sbin/useradd
81 Requires(post,preun,postun): systemd-units >= 38
82 Requires: systemd-units >= 38
83 Requires(triggerpostun): sed >= 4.0
84 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
85 Requires: /usr/sbin/usermod
86 Requires: rc-scripts >= 0.4.1.23
87 Suggests: clamav-database
89 Provides: group(clamav)
90 Provides: user(clamav)
91 Conflicts: logrotate < 3.7-4
92 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
95 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
96 especially for e-mail scanning on mail gateways. It provides a number
97 of utilities including a flexible and scalable multi-threaded daemon,
98 a command line scanner and advanced tool for automatic database
99 updates. The core of the package is an anti-virus engine available in
100 a form of shared library (available in clamav-libs).
102 Here is a list of the main features:
103 - command-line scanner
104 - fast, multi-threaded daemon with support for on-access scanning
105 - milter interface for sendmail
106 - advanced database updater with support for scripted updates and
108 - virus scanner C library
109 - on-access scanning (Linux and FreeBSD)
110 - virus database updated multiple times per day (see home page for
111 total number of signatures)
112 - built-in support for various archive formats, including Zip, RAR,
113 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
114 - built-in support for almost all mail file formats
115 - built-in support for ELF executables and Portable Executable files
116 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
117 obfuscated with SUE, Y0da Cryptor and others
118 - built-in support for popular document formats including MS Office
119 and MacOffice files, HTML, RTF and PDF
121 %description -l pl.UTF-8
122 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
123 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
124 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
125 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
126 skaner działający z linii poleceń oraz zaawansowane narzędzie do
127 automatycznej aktualizacji bazy danych. Główna część pakietu to
128 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
129 (dostępnej w pakiecie clamav-libs).
131 Lista podstawowych możliwości:
132 - skaner działający z linii poleceń
133 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
134 - interfejs milter dla sendmaila
135 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
136 aktualizacji oskryptowanych oraz podpisów cyfrowych
137 - biblioteka C skanera antywirusowego
138 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
139 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
140 sygnatur dostępna na stronie projektu)
141 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
142 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
143 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
144 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
145 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
146 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
147 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
148 Office, MacOffice, HTML, RTF i PDF
151 Summary: Shared libraries for clamav
152 Summary(pl.UTF-8): Biblioteki dzielone clamav
154 Requires: zlib >= 1.2.2
157 Shared libraries for clamav.
159 %description libs -l pl.UTF-8
160 Biblioteki dzielone clamav.
163 Summary: ClamAV filter using milter interface
164 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
166 Requires: %{name} = %{epoch}:%{version}-%{release}
168 #Requires: sendmail >= 8.11
169 Requires: tcp_wrappers
172 ClamAV sendmail filter using MILTER interface.
174 %description milter -l pl.UTF-8
175 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
178 Summary: clamav - Development header files and libraries
179 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
180 Group: Development/Libraries
181 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
182 Requires: bzip2-devel
185 Requires: openssl-devel >= 0.9.8
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.
212 %if "%{pld_release}" == "ac"
215 %if "%{pld_release}" != "ac"
223 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
224 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
233 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
234 %{?with_milter:--enable-milter} \
235 --disable-silent-rules \
236 --disable-zlib-vcheck \
237 --with-dbdir=/var/lib/%{name} \
238 --with-ltdl-include=%{_includedir} \
239 --with-ltdl-lib=%{_libdir} \
241 %{?with_system_libmspack:--with-system-libmspack}
244 LIBTOOL=%{_bindir}/libtool
247 rm -rf $RPM_BUILD_ROOT
248 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
249 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
250 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
251 $RPM_BUILD_ROOT%{systemdunitdir}
254 LIBTOOL=%{_bindir}/libtool \
255 DESTDIR=$RPM_BUILD_ROOT
256 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
258 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
259 5 * * * * root %{_sbindir}/clamav-cron-updatedb
262 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
264 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
265 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
267 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
268 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
269 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
272 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
274 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
276 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
278 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
279 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
280 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
282 # NOTE: clamd uses sane rights to it's clamd.pid file
283 # So better keep it dir
284 # If it is fixed use of dir will be unecesary
285 install -d $RPM_BUILD_ROOT/var/run/%{name}
287 :> $RPM_BUILD_ROOT/var/log/freshclam.log
290 rm -rf $RPM_BUILD_ROOT
292 %triggerin -- amavis-ng
293 %addusertogroup -q clamav amavis
295 %triggerin -- amavisd-new
296 %addusertogroup -q clamav amavis
298 %triggerin -- amavisd
299 %addusertogroup -q clamav amavis
302 %groupadd -g 43 clamav
303 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
306 /sbin/chkconfig --add clamd
307 %service clamd restart "Clam Antivirus daemon"
308 touch /var/log/freshclam.log
309 chown clamav:root /var/log/freshclam.log
310 chmod 640 /var/log/freshclam.log
311 %systemd_post clamd.service cronjob-clamav.timer
314 if [ "$1" = "0" ]; then
316 /sbin/chkconfig --del clamd
318 %systemd_preun clamd.service cronjob-clamav.timer
321 if [ "$1" = "0" ]; then
327 %triggerpostun -- %{name} < 0.80
328 if [ -f /etc/clamav.conf.rpmsave ]; then
329 echo "Renaming config to new name /etc/clamd.conf"
330 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
331 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
332 echo "Changing config location in freshclam config"
333 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
336 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
337 %{__cp} -f /etc/clamd.conf{,.rpmsave}
340 s,^FixStaleSocket$,& yes,
341 s,^AllowSupplementaryGroups$,& yes,
342 s,^ClamukoScanOnOpen$,& yes,
343 s,^ClamukoScanOnClose$,& yes,
344 s,^ClamukoScanOnExec$,& yes,
348 %banner -e %{name}-0.90 <<EOF
349 ClamAV config was automatically upgraded to 0.90 format. You should review it
350 that it's still valid.
353 # unfortunately clamd has no configcheck option so we just have to start it
354 # once again after config was broken after upgrade
355 touch /var/lock/subsys/clamd
356 %service -q clamd restart
358 %triggerpostun -- %{name} < 0.97.7-4
359 %systemd_trigger clamd.service
361 %triggerpostun -- %{name} < 0.99.2-2
362 %systemd_service_enable cronjob-clamav.timer
365 /sbin/chkconfig --add clamav-milter
366 %service clamav-milter restart "Clam Antivirus daemon"
369 if [ "$1" = "0" ]; then
370 %service clamav-milter stop
371 /sbin/chkconfig --del clamav-milter
374 %post libs -p /sbin/ldconfig
375 %postun libs -p /sbin/ldconfig
378 %defattr(644,root,root,755)
379 %doc ChangeLog.md NEWS.md README.md
380 %attr(755,root,root) %{_bindir}/clambc
381 %attr(755,root,root) %{_bindir}/clamdscan
382 %attr(755,root,root) %{_bindir}/clamdtop
383 %attr(755,root,root) %{_bindir}/clamonacc
384 %attr(755,root,root) %{_bindir}/clamscan
385 %attr(755,root,root) %{_bindir}/clamsubmit
386 %attr(755,root,root) %{_bindir}/freshclam
387 %attr(755,root,root) %{_bindir}/sigtool
388 %attr(755,root,root) %{_bindir}/clamconf
389 %attr(755,root,root) %{_sbindir}/clamd
390 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
391 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
392 %{systemdtmpfilesdir}/%{name}.conf
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
411 %{_mandir}/man5/clamd*
412 %{_mandir}/man5/freshclam*
413 %{_mandir}/man8/clamd*
417 %defattr(644,root,root,755)
418 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
419 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
420 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
421 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
422 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
423 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
424 %attr(755,root,root) %{_sbindir}/clamav-milter
425 %{_mandir}/man5/clamav-milter*
426 %{_mandir}/man8/clamav-milter.8*
427 %attr(700,clamav,clamav) /var/spool/clamav
431 %defattr(644,root,root,755)
432 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
433 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
434 %if %{without system_libmspack}
435 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
436 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
438 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
439 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
440 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
441 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
442 %attr(755,root,root) %{_libdir}/libfreshclam.so.*.*.*
443 %attr(755,root,root) %ghost %{_libdir}/libfreshclam.so.2
446 %defattr(644,root,root,755)
447 %attr(755,root,root) %{_bindir}/clamav-config
448 %attr(755,root,root) %{_libdir}/libclamav.so
449 %if %{without system_libmspack}
450 %attr(755,root,root) %{_libdir}/libclammspack.so
452 %attr(755,root,root) %{_libdir}/libclamunrar.so
453 %attr(755,root,root) %{_libdir}/libfreshclam.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}/libfreshclam.la
461 %{_libdir}/libclamunrar_iface.la
462 %dir %{_includedir}/clamav
463 %{_includedir}/clamav/clamav.h
464 %{_includedir}/clamav/clamav-types.h
465 %{_includedir}/clamav/clamav-version.h
466 %{_includedir}/clamav/libfreshclam.h
467 %{_pkgconfigdir}/libclamav.pc
470 %defattr(644,root,root,755)
471 %{_libdir}/libclamav.a
472 %if %{without system_libmspack}
473 %{_libdir}/libclammspack.a
475 %{_libdir}/libclamunrar.a
476 %{_libdir}/libfreshclam.a
477 %{_libdir}/libclamunrar_iface.a