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 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: zlib-devel >= 1.2.2
72 Requires(post,preun): /sbin/chkconfig
73 Requires(postun): /usr/sbin/groupdel
74 Requires(postun): /usr/sbin/userdel
75 Requires(postun,pre): /usr/sbin/usermod
76 Requires(pre): /bin/id
77 Requires(pre): /usr/bin/getgid
78 Requires(pre): /usr/sbin/groupadd
79 Requires(pre): /usr/sbin/useradd
80 Requires(post,preun,postun): systemd-units >= 38
81 Requires: systemd-units >= 38
82 Requires(triggerpostun): sed >= 4.0
83 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
84 Requires: /usr/sbin/usermod
85 Requires: rc-scripts >= 0.4.1.23
86 Suggests: clamav-database
88 Provides: group(clamav)
89 Provides: user(clamav)
90 Conflicts: logrotate < 3.7-4
91 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
94 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
95 especially for e-mail scanning on mail gateways. It provides a number
96 of utilities including a flexible and scalable multi-threaded daemon,
97 a command line scanner and advanced tool for automatic database
98 updates. The core of the package is an anti-virus engine available in
99 a form of shared library (available in clamav-libs).
101 Here is a list of the main features:
102 - command-line scanner
103 - fast, multi-threaded daemon with support for on-access scanning
104 - milter interface for sendmail
105 - advanced database updater with support for scripted updates and
107 - virus scanner C library
108 - on-access scanning (Linux and FreeBSD)
109 - virus database updated multiple times per day (see home page for
110 total number of signatures)
111 - built-in support for various archive formats, including Zip, RAR,
112 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
113 - built-in support for almost all mail file formats
114 - built-in support for ELF executables and Portable Executable files
115 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
116 obfuscated with SUE, Y0da Cryptor and others
117 - built-in support for popular document formats including MS Office
118 and MacOffice files, HTML, RTF and PDF
120 %description -l pl.UTF-8
121 Clam AntiVirus to mające otwarte źródła narzędzie antywirusowe dla
122 systemów uniksowych, zaprojektowane szczególnie pod kątem skanowania
123 poczty elektronicznej na bramkach pocztowych. Udostępnia wiele
124 narzędzi, w tym elastycznego i skalowalnego, multiwątkowego demona,
125 skaner działający z linii poleceń oraz zaawansowane narzędzie do
126 automatycznej aktualizacji bazy danych. Główna część pakietu to
127 silnik antywirusowy dostępny w postaci biblioteki współdzielonej
128 (dostępnej w pakiecie clamav-libs).
130 Lista podstawowych możliwości:
131 - skaner działający z linii poleceń
132 - szybki, wielowątkowy demon z obsługą skanowania przy odczycie
133 - interfejs milter dla sendmaila
134 - zaawansowane narzędzie do aktualizacji bazy danych z obsługą
135 aktualizacji oskryptowanych oraz podpisów cyfrowych
136 - biblioteka C skanera antywirusowego
137 - skanowanie przy odczycie (dla Linuksa i FreeBSD)
138 - baza danych wirusów aktualizowana wiele razy dziennie (liczba
139 sygnatur dostępna na stronie projektu)
140 - wbudowana obsługa różnych formatów archiwów, w tym Zip, RAR, Tar,
141 Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS i inne
142 - wbudowana obsługa prawie wszystkich formatów plików pocztowych
143 - wbudowana obsługa plików wykonywalnych ELF i PE skompresowanych
144 programami UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack oraz
145 zaciemnionych przy użyciu programów SUE, Y0da Cryptor i innych
146 - wbudowana obsługa popularnych formatów dokumentów, w tym plików MS
147 Office, MacOffice, HTML, RTF i PDF
150 Summary: Shared libraries for clamav
151 Summary(pl.UTF-8): Biblioteki dzielone clamav
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
184 Requires: openssl-devel >= 0.9.8
185 Requires: zlib-devel >= 1.2.2
188 This package contains the development header files and libraries
189 necessary to develop clamav client applications.
191 %description devel -l pl.UTF-8
192 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
196 Summary: clamav static libraries
197 Summary(pl.UTF-8): Biblioteki statyczne clamav
198 Group: Development/Libraries
199 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
202 clamav static libraries.
204 %description static -l pl.UTF-8
205 Biblioteki statyczne clamav.
211 %if "%{pld_release}" == "ac"
214 %if "%{pld_release}" != "ac"
222 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
223 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
232 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
233 %{?with_milter:--enable-milter} \
234 --disable-silent-rules \
235 --disable-zlib-vcheck \
236 --with-dbdir=/var/lib/%{name} \
237 --with-ltdl-include=%{_includedir} \
238 --with-ltdl-lib=%{_libdir} \
240 %{?with_system_libmspack:--with-system-libmspack}
243 LIBTOOL=%{_bindir}/libtool
246 rm -rf $RPM_BUILD_ROOT
247 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
248 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
249 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
250 $RPM_BUILD_ROOT%{systemdunitdir}
253 LIBTOOL=%{_bindir}/libtool \
254 DESTDIR=$RPM_BUILD_ROOT
255 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
257 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
258 5 * * * * root %{_sbindir}/clamav-cron-updatedb
261 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
263 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
264 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
266 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
267 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
268 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
271 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
273 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
275 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
277 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
278 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
279 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
281 # NOTE: clamd uses sane rights to it's clamd.pid file
282 # So better keep it dir
283 # If it is fixed use of dir will be unecesary
284 install -d $RPM_BUILD_ROOT/var/run/%{name}
286 :> $RPM_BUILD_ROOT/var/log/freshclam.log
289 rm -rf $RPM_BUILD_ROOT
291 %triggerin -- amavis-ng
292 %addusertogroup -q clamav amavis
294 %triggerin -- amavisd-new
295 %addusertogroup -q clamav amavis
297 %triggerin -- amavisd
298 %addusertogroup -q clamav amavis
301 %groupadd -g 43 clamav
302 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
305 /sbin/chkconfig --add clamd
306 %service clamd restart "Clam Antivirus daemon"
307 touch /var/log/freshclam.log
308 chown clamav:root /var/log/freshclam.log
309 chmod 640 /var/log/freshclam.log
310 %systemd_post clamd.service cronjob-clamav.timer
313 if [ "$1" = "0" ]; then
315 /sbin/chkconfig --del clamd
317 %systemd_preun clamd.service cronjob-clamav.timer
320 if [ "$1" = "0" ]; then
326 %triggerpostun -- %{name} < 0.80
327 if [ -f /etc/clamav.conf.rpmsave ]; then
328 echo "Renaming config to new name /etc/clamd.conf"
329 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
330 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
331 echo "Changing config location in freshclam config"
332 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
335 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
336 %{__cp} -f /etc/clamd.conf{,.rpmsave}
339 s,^FixStaleSocket$,& yes,
340 s,^AllowSupplementaryGroups$,& yes,
341 s,^ClamukoScanOnOpen$,& yes,
342 s,^ClamukoScanOnClose$,& yes,
343 s,^ClamukoScanOnExec$,& yes,
347 %banner -e %{name}-0.90 <<EOF
348 ClamAV config was automatically upgraded to 0.90 format. You should review it
349 that it's still valid.
352 # unfortunately clamd has no configcheck option so we just have to start it
353 # once again after config was broken after upgrade
354 touch /var/lock/subsys/clamd
355 %service -q clamd restart
357 %triggerpostun -- %{name} < 0.97.7-4
358 %systemd_trigger clamd.service
360 %triggerpostun -- %{name} < 0.99.2-2
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}/clamd
388 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
389 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
390 %{systemdtmpfilesdir}/%{name}.conf
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
409 %{_mandir}/man5/clamd*
410 %{_mandir}/man5/freshclam*
411 %{_mandir}/man8/clamd*
415 %defattr(644,root,root,755)
416 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
417 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
418 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
419 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
420 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
421 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
422 %attr(755,root,root) %{_sbindir}/clamav-milter
423 %{_mandir}/man5/clamav-milter*
424 %{_mandir}/man8/clamav-milter.8*
425 %attr(700,clamav,clamav) /var/spool/clamav
429 %defattr(644,root,root,755)
430 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
431 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
432 %if %{without system_libmspack}
433 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
434 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
436 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
437 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
438 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
439 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
442 %defattr(644,root,root,755)
443 %attr(755,root,root) %{_bindir}/clamav-config
444 %attr(755,root,root) %{_libdir}/libclamav.so
445 %if %{without system_libmspack}
446 %attr(755,root,root) %{_libdir}/libclammspack.so
448 %attr(755,root,root) %{_libdir}/libclamunrar.so
449 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
450 %{_libdir}/libclamav.la
451 %if %{without system_libmspack}
452 %{_libdir}/libclammspack.la
454 %{_libdir}/libclamunrar.la
455 %{_libdir}/libclamunrar_iface.la
456 %{_includedir}/clamav.h
457 %{_pkgconfigdir}/libclamav.pc
460 %defattr(644,root,root,755)
461 %{_libdir}/libclamav.a
462 %if %{without system_libmspack}
463 %{_libdir}/libclammspack.a
465 %{_libdir}/libclamunrar.a
466 %{_libdir}/libclamunrar_iface.a