]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- rel 2; don't trash stderr with meaningless errors, log these instead
[packages/clamav.git] / clamav.spec
1 # TODO:
2 # - Make freshclam package (script and daemon)
3 # - restart amavis in triggers if group membership was modified?
4 #
5 # Conditional build:
6 %bcond_without  milter          # milter interface subpackage
7 %if "%{pld_release}" == "ac"
8 %bcond_with     llvm            # LLVM support
9 %else
10 %bcond_without  llvm            # LLVM support
11 %endif
12
13 Summary:        An anti-virus utility for Unix
14 Summary(pl.UTF-8):      Narzędzie antywirusowe dla Uniksów
15 Name:           clamav
16 Version:        0.98.1
17 Release:        2
18 License:        GPL v2+
19 Group:          Daemons
20 Source0:        http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
21 # Source0-md5:  b1ec7b19dea8385954515ef1d63576d8
22 Source1:        %{name}.init
23 Source2:        %{name}.sysconfig
24 Source3:        %{name}-milter.init
25 Source4:        %{name}-cron-updatedb
26 Source5:        %{name}.logrotate
27 Source8:        %{name}-post-updatedb
28 Source9:        %{name}-milter.sysconfig
29 Source10:       %{name}.tmpfiles
30 Source11:       clamd.service
31 Patch0:         %{name}-pld_config.patch
32 Patch1:         %{name}-nolibs.patch
33 Patch2:         am-nosilentrules.patch
34 Patch3:         ac2.68.patch
35 Patch4:         %{name}-notify-error.patch
36 URL:            http://www.clamav.net/
37 BuildRequires:  autoconf
38 BuildRequires:  automake
39 BuildRequires:  bzip2-devel
40 BuildRequires:  gmp-devel
41 BuildRequires:  libltdl-devel
42 %{?with_milter:BuildRequires:   libmilter-devel}
43 BuildRequires:  libstdc++-devel
44 BuildRequires:  libtool
45 BuildRequires:  llvm-devel
46 %{?with_milter:BuildRequires:   libwrap-devel}
47 %{?with_llvm:BuildRequires:     llvm-devel}
48 BuildRequires:  ncurses-devel
49 BuildRequires:  rpm >= 4.4.9-56
50 BuildRequires:  rpmbuild(macros) >= 1.647
51 BuildRequires:  zlib-devel
52 Requires(post,preun):   /sbin/chkconfig
53 Requires(postun):       /usr/sbin/groupdel
54 Requires(postun):       /usr/sbin/userdel
55 Requires(postun,pre):   /usr/sbin/usermod
56 Requires(pre):  /bin/id
57 Requires(pre):  /usr/bin/getgid
58 Requires(pre):  /usr/sbin/groupadd
59 Requires(pre):  /usr/sbin/useradd
60 Requires(post,preun,postun):    systemd-units >= 38
61 Requires:       systemd-units >= 38
62 Requires(triggerpostun):        sed >= 4.0
63 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
64 Requires:       /usr/sbin/usermod
65 Requires:       rc-scripts >= 0.4.1.23
66 Suggests:       clamav-database
67 Provides:       group(clamav)
68 Provides:       user(clamav)
69 Conflicts:      logrotate < 3.7-4
70 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
71
72 %description
73 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
74 especially for e-mail scanning on mail gateways. It provides a number
75 of utilities including a flexible and scalable multi-threaded daemon,
76 a command line scanner and advanced tool for automatic database
77 updates. The core of the package is an anti-virus engine available in
78 a form of shared library.
79
80 Here is a list of the main features:
81 - command-line scanner
82 - fast, multi-threaded daemon with support for on-access scanning
83 - milter interface for sendmail
84 - advanced database updater with support for scripted updates and
85   digital signatures
86 - virus scanner C library
87 - on-access scanning (Linux® and FreeBSD®)
88 - virus database updated multiple times per day (see home page for
89   total number of signatures)
90 - built-in support for various archive formats, including Zip, RAR,
91   Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
92 - built-in support for almost all mail file formats
93 - built-in support for ELF executables and Portable Executable files
94   compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
95   obfuscated with SUE, Y0da Cryptor and others
96 - built-in support for popular document formats including MS Office
97   and MacOffice files, HTML, RTF and PDF
98
99 %description -l pl.UTF-8
100 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
101 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
102 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
103 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
104 napisany w C i zgodny z POSIXem.
105
106 %package libs
107 Summary:        Shared libraries for clamav
108 Summary(pl.UTF-8):      Biblioteki dzielone clamav
109 Group:          Libraries
110
111 %description libs
112 Shared libraries for clamav.
113
114 %description libs -l pl.UTF-8
115 Biblioteki dzielone clamav.
116
117 %package milter
118 Summary:        ClamAV filter using milter interface
119 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
120 Group:          Daemons
121 Requires:       %{name} = %{epoch}:%{version}-%{release}
122 Requires:       postfix
123 #Requires:      sendmail >= 8.11
124 Requires:       tcp_wrappers
125
126 %description milter
127 ClamAV sendmail filter using MILTER interface.
128
129 %description milter -l pl.UTF-8
130 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
131
132 %package devel
133 Summary:        clamav - Development header files and libraries
134 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
135 Group:          Development/Libraries
136 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
137 Requires:       bzip2-devel
138 Requires:       gmp-devel
139 Requires:       zlib-devel
140
141 %description devel
142 This package contains the development header files and libraries
143 necessary to develop clamav client applications.
144
145 %description devel -l pl.UTF-8
146 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
147 klienckich clamav.
148
149 %package static
150 Summary:        clamav static libraries
151 Summary(pl.UTF-8):      Biblioteki statyczne clamav
152 Group:          Development/Libraries
153 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
154
155 %description static
156 clamav static libraries.
157
158 %description static -l pl.UTF-8
159 Biblioteki statyczne clamav.
160
161 %prep
162 %setup -q
163 %patch0 -p1
164 %patch1 -p1
165 %patch2 -p1
166 %patch3 -p1
167 %patch4 -p1
168
169 %build
170 %{__libtoolize}
171 %{__aclocal} -I m4
172 %{__autoconf}
173 %{__autoheader}
174 %{__automake}
175 %configure \
176         --disable-silent-rules \
177         --disable-clamav \
178         --enable-clamdtop \
179         %{?with_milter:--enable-milter} \
180         --with-dbdir=/var/lib/%{name} \
181         --with-no-cache \
182         --with-ltdl-include=%{_includedir} \
183         --with-ltdl-lib=%{_libdir}
184
185 %{__make} \
186         LIBTOOL=%{_bindir}/libtool
187
188 %install
189 rm -rf $RPM_BUILD_ROOT
190 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
191         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
192         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
193         $RPM_BUILD_ROOT%{systemdunitdir}
194
195 %{__make} install \
196         LIBTOOL=%{_bindir}/libtool \
197         DESTDIR=$RPM_BUILD_ROOT
198 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
199
200 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
201 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
202 EOF
203
204 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
205 %if %{with milter}
206 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
207 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
208 %endif
209 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
210 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
211 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
212         mv $i ${i%%.sample}
213 done
214 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
215
216 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
217
218 install %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
219
220 install %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
221
222 # NOTE: clamd uses sane rights to it's clamd.pid file
223 # So better keep it dir
224 # If it is fixed use of dir will be unecesary
225 install -d $RPM_BUILD_ROOT/var/run/%{name}
226
227 :> $RPM_BUILD_ROOT/var/log/freshclam.log
228
229 %clean
230 rm -rf $RPM_BUILD_ROOT
231
232 %triggerin -- amavis-ng
233 %addusertogroup -q clamav amavis
234
235 %triggerin -- amavisd-new
236 %addusertogroup -q clamav amavis
237
238 %triggerin -- amavisd
239 %addusertogroup -q clamav amavis
240
241 %pre
242 %groupadd -g 43 clamav
243 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
244
245 %post
246 /sbin/chkconfig --add clamd
247 %service clamd restart "Clam Antivirus daemon"
248 touch /var/log/freshclam.log
249 chown clamav:root /var/log/freshclam.log
250 chmod 640 /var/log/freshclam.log
251 %systemd_post clamd.service
252
253 %preun
254 if [ "$1" = "0" ]; then
255         %service clamd stop
256         /sbin/chkconfig --del clamd
257 fi
258 %systemd_preun clamd.service
259
260 %postun
261 if [ "$1" = "0" ]; then
262         %userremove clamav
263         %groupremove clamav
264 fi
265 %systemd_reload
266
267 %triggerpostun -- %{name} < 0.80
268 if [ -f /etc/clamav.conf.rpmsave ]; then
269         echo "Renaming config to new name /etc/clamd.conf"
270         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
271         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
272         echo "Changing config location in freshclam config"
273         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
274 fi
275
276 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
277 %{__cp} -f /etc/clamd.conf{,.rpmsave}
278 %{__sed} -i -e '
279                 s,^LogSyslog$,& yes,
280                 s,^FixStaleSocket$,& yes,
281                 s,^AllowSupplementaryGroups$,& yes,
282                 s,^ClamukoScanOnOpen$,& yes,
283                 s,^ClamukoScanOnClose$,& yes,
284                 s,^ClamukoScanOnExec$,& yes,
285                 s,^LogTime$,& yes,
286                 s,^ScanPE$,& yes,
287 ' /etc/clamd.conf
288 %banner -e %{name}-0.90 <<EOF
289 ClamAV config was automatically upgraded to 0.90 format. You should review it
290 that it's still valid.
291 EOF
292 #'
293 # unfortunately clamd has no configcheck option so we just have to start it
294 # once again after config was broken after upgrade
295 touch /var/lock/subsys/clamd
296 %service -q clamd restart
297
298 %triggerpostun -- %{name} < 0.97.7-4
299 %systemd_trigger clamd.service
300
301 %post milter
302 /sbin/chkconfig --add clamav-milter
303 %service clamav-milter restart "Clam Antivirus daemon"
304
305 %preun milter
306 if [ "$1" = "0" ]; then
307         %service clamav-milter stop
308         /sbin/chkconfig --del clamav-milter
309 fi
310
311 %post   libs -p /sbin/ldconfig
312 %postun libs -p /sbin/ldconfig
313
314 %files
315 %defattr(644,root,root,755)
316 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
317 %attr(755,root,root) %{_bindir}/clambc
318 %attr(755,root,root) %{_bindir}/clamdscan
319 %attr(755,root,root) %{_bindir}/clamdtop
320 %attr(755,root,root) %{_bindir}/clamscan
321 %attr(755,root,root) %{_bindir}/freshclam
322 %attr(755,root,root) %{_bindir}/sigtool
323 %attr(755,root,root) %{_bindir}/clamconf
324 %attr(755,root,root) %{_sbindir}/clamd
325 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
326 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
327 %{systemdtmpfilesdir}/%{name}.conf
328 %{systemdunitdir}/clamd.service
329 %attr(755,clamav,root) %dir /var/lib/%{name}
330 %attr(640,clamav,root) %ghost /var/log/freshclam.log
331 %attr(750,clamav,clamav) %dir /var/run/%{name}
332
333 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
334 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
335 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
336
337 %attr(754,root,root) /etc/rc.d/init.d/clamd
338 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
339 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
340 %{_mandir}/man[15]/*
341 %{_mandir}/man8/clamd*
342
343 %if %{with milter}
344 %files milter
345 %defattr(644,root,root,755)
346 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
347 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
348 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
349 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
350 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
351 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
352 %attr(755,root,root) %{_sbindir}/clamav-milter
353 %{_mandir}/man8/clamav-milter.8*
354 %attr(700,clamav,clamav) /var/spool/clamav
355 %endif
356
357 %files libs
358 %defattr(644,root,root,755)
359 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
360 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
361 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
362 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
363 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
364 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
365
366 %files devel
367 %defattr(644,root,root,755)
368 %attr(755,root,root) %{_bindir}/clamav-config
369 %attr(755,root,root) %{_libdir}/libclamav.so
370 %attr(755,root,root) %{_libdir}/libclamunrar.so
371 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
372 %{_libdir}/libclamav.la
373 %{_libdir}/libclamunrar.la
374 %{_libdir}/libclamunrar_iface.la
375 %{_includedir}/clamav.h
376 %{_pkgconfigdir}/libclamav.pc
377
378 %files static
379 %defattr(644,root,root,755)
380 %{_libdir}/libclamav.a
381 %{_libdir}/libclamunrar.a
382 %{_libdir}/libclamunrar_iface.a
This page took 0.069611 seconds and 3 git commands to generate.