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.
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 jest potężnym skanerem antywirusowym dla systemów
122 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
123 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
124 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
125 napisany w C i zgodny z POSIXem.
128 Summary: Shared libraries for clamav
129 Summary(pl.UTF-8): Biblioteki dzielone clamav
131 Requires: zlib >= 1.2.2
134 Shared libraries for clamav.
136 %description libs -l pl.UTF-8
137 Biblioteki dzielone clamav.
140 Summary: ClamAV filter using milter interface
141 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
143 Requires: %{name} = %{epoch}:%{version}-%{release}
145 #Requires: sendmail >= 8.11
146 Requires: tcp_wrappers
149 ClamAV sendmail filter using MILTER interface.
151 %description milter -l pl.UTF-8
152 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
155 Summary: clamav - Development header files and libraries
156 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
157 Group: Development/Libraries
158 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
159 Requires: bzip2-devel
162 Requires: openssl-devel >= 0.9.8
163 Requires: zlib-devel >= 1.2.2
166 This package contains the development header files and libraries
167 necessary to develop clamav client applications.
169 %description devel -l pl.UTF-8
170 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
174 Summary: clamav static libraries
175 Summary(pl.UTF-8): Biblioteki statyczne clamav
176 Group: Development/Libraries
177 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
180 clamav static libraries.
182 %description static -l pl.UTF-8
183 Biblioteki statyczne clamav.
189 %if "%{pld_release}" == "ac"
192 %if "%{pld_release}" != "ac"
200 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
201 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
210 %{?with_llvm:--enable-llvm %{!?with_system_llvm:--with-system-llvm=no}} \
211 %{?with_milter:--enable-milter} \
212 --disable-silent-rules \
213 --disable-zlib-vcheck \
214 --with-dbdir=/var/lib/%{name} \
215 --with-ltdl-include=%{_includedir} \
216 --with-ltdl-lib=%{_libdir} \
218 %{?with_system_libmspack:--with-system-libmspack}
221 LIBTOOL=%{_bindir}/libtool
224 rm -rf $RPM_BUILD_ROOT
225 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
226 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
227 $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
228 $RPM_BUILD_ROOT%{systemdunitdir}
231 LIBTOOL=%{_bindir}/libtool \
232 DESTDIR=$RPM_BUILD_ROOT
233 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
235 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
236 5 * * * * root %{_sbindir}/clamav-cron-updatedb
239 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
241 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
242 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
244 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
245 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
246 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
249 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
251 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
253 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
255 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
256 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
257 sed -e's#@sbindir@#%{_sbindir}#' < %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
259 # NOTE: clamd uses sane rights to it's clamd.pid file
260 # So better keep it dir
261 # If it is fixed use of dir will be unecesary
262 install -d $RPM_BUILD_ROOT/var/run/%{name}
264 :> $RPM_BUILD_ROOT/var/log/freshclam.log
267 rm -rf $RPM_BUILD_ROOT
269 %triggerin -- amavis-ng
270 %addusertogroup -q clamav amavis
272 %triggerin -- amavisd-new
273 %addusertogroup -q clamav amavis
275 %triggerin -- amavisd
276 %addusertogroup -q clamav amavis
279 %groupadd -g 43 clamav
280 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
283 /sbin/chkconfig --add clamd
284 %service clamd restart "Clam Antivirus daemon"
285 touch /var/log/freshclam.log
286 chown clamav:root /var/log/freshclam.log
287 chmod 640 /var/log/freshclam.log
288 %systemd_post clamd.service cronjob-clamav.timer
291 if [ "$1" = "0" ]; then
293 /sbin/chkconfig --del clamd
295 %systemd_preun clamd.service cronjob-clamav.timer
298 if [ "$1" = "0" ]; then
304 %triggerpostun -- %{name} < 0.80
305 if [ -f /etc/clamav.conf.rpmsave ]; then
306 echo "Renaming config to new name /etc/clamd.conf"
307 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
308 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
309 echo "Changing config location in freshclam config"
310 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
313 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
314 %{__cp} -f /etc/clamd.conf{,.rpmsave}
317 s,^FixStaleSocket$,& yes,
318 s,^AllowSupplementaryGroups$,& yes,
319 s,^ClamukoScanOnOpen$,& yes,
320 s,^ClamukoScanOnClose$,& yes,
321 s,^ClamukoScanOnExec$,& yes,
325 %banner -e %{name}-0.90 <<EOF
326 ClamAV config was automatically upgraded to 0.90 format. You should review it
327 that it's still valid.
330 # unfortunately clamd has no configcheck option so we just have to start it
331 # once again after config was broken after upgrade
332 touch /var/lock/subsys/clamd
333 %service -q clamd restart
335 %triggerpostun -- %{name} < 0.97.7-4
336 %systemd_trigger clamd.service
338 %triggerpostun -- %{name} < 0.99.2-2
339 %systemd_service_enable cronjob-clamav.timer
342 /sbin/chkconfig --add clamav-milter
343 %service clamav-milter restart "Clam Antivirus daemon"
346 if [ "$1" = "0" ]; then
347 %service clamav-milter stop
348 /sbin/chkconfig --del clamav-milter
351 %post libs -p /sbin/ldconfig
352 %postun libs -p /sbin/ldconfig
355 %defattr(644,root,root,755)
356 %doc ChangeLog.md NEWS.md README.md
357 %attr(755,root,root) %{_bindir}/clambc
358 %attr(755,root,root) %{_bindir}/clamdscan
359 %attr(755,root,root) %{_bindir}/clamdtop
360 %attr(755,root,root) %{_bindir}/clamscan
361 %attr(755,root,root) %{_bindir}/clamsubmit
362 %attr(755,root,root) %{_bindir}/freshclam
363 %attr(755,root,root) %{_bindir}/sigtool
364 %attr(755,root,root) %{_bindir}/clamconf
365 %attr(755,root,root) %{_sbindir}/clamd
366 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
367 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
368 %{systemdtmpfilesdir}/%{name}.conf
369 %{systemdunitdir}/clamav-daemon.service
370 %{systemdunitdir}/clamav-daemon.socket
371 %{systemdunitdir}/clamav-freshclam.service
372 %{systemdunitdir}/clamd.service
373 %{systemdunitdir}/cronjob-clamav.service
374 %{systemdunitdir}/cronjob-clamav.timer
375 %attr(755,clamav,root) %dir /var/lib/%{name}
376 %attr(640,clamav,root) %ghost /var/log/freshclam.log
377 %attr(750,clamav,clamav) %dir /var/run/%{name}
379 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
380 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
381 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
383 %attr(754,root,root) /etc/rc.d/init.d/clamd
384 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
385 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
387 %{_mandir}/man5/clamd*
388 %{_mandir}/man5/freshclam*
389 %{_mandir}/man8/clamd*
393 %defattr(644,root,root,755)
394 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
395 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
396 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
397 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
398 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
399 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
400 %attr(755,root,root) %{_sbindir}/clamav-milter
401 %{_mandir}/man5/clamav-milter*
402 %{_mandir}/man8/clamav-milter.8*
403 %attr(700,clamav,clamav) /var/spool/clamav
407 %defattr(644,root,root,755)
408 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
409 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.9
410 %if %{without system_libmspack}
411 %attr(755,root,root) %{_libdir}/libclammspack.*.*.*
412 %attr(755,root,root) %ghost %{_libdir}/libclammspack.so.0
414 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
415 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.9
416 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
417 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.9
420 %defattr(644,root,root,755)
421 %attr(755,root,root) %{_bindir}/clamav-config
422 %attr(755,root,root) %{_libdir}/libclamav.so
423 %if %{without system_libmspack}
424 %attr(755,root,root) %{_libdir}/libclammspack.so
426 %attr(755,root,root) %{_libdir}/libclamunrar.so
427 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
428 %{_libdir}/libclamav.la
429 %if %{without system_libmspack}
430 %{_libdir}/libclammspack.la
432 %{_libdir}/libclamunrar.la
433 %{_libdir}/libclamunrar_iface.la
434 %{_includedir}/clamav.h
435 %{_pkgconfigdir}/libclamav.pc
438 %defattr(644,root,root,755)
439 %{_libdir}/libclamav.a
440 %if %{without system_libmspack}
441 %{_libdir}/libclammspack.a
443 %{_libdir}/libclamunrar.a
444 %{_libdir}/libclamunrar_iface.a