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