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