]> TLD Linux GIT Repositories - packages/clamav.git/blob - clamav.spec
- merged 0.98.3 from PLD, fixed ac patch
[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.98.3
13 Release:        1
14 License:        GPL v2+
15 Group:          Daemons
16 Source0:        http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
17 # Source0-md5:  b649d35ee85d4d6075a98173dd255c17
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 Source10:       %{name}.tmpfiles
26 Source11:       clamd.service
27 Patch0:         %{name}-config.patch
28 Patch1:         %{name}-nolibs.patch
29 Patch2:         ac2.68.patch
30 Patch3:         %{name}-openssl.patch
31 Patch4:         %{name}-major.patch
32 URL:            http://www.clamav.net/
33 BuildRequires:  autoconf
34 BuildRequires:  automake
35 BuildRequires:  bzip2-devel
36 BuildRequires:  curl-devel
37 BuildRequires:  gmp-devel
38 BuildRequires:  libltdl-devel
39 %{?with_milter:BuildRequires:   libmilter-devel}
40 BuildRequires:  libstdc++-devel
41 BuildRequires:  libtool
42 %{?with_milter:BuildRequires:   libwrap-devel}
43 %{?with_llvm:BuildRequires:     llvm-devel}
44 BuildRequires:  ncurses-devel
45 BuildRequires:  openssl-devel
46 BuildRequires:  rpm >= 4.4.9-56
47 BuildRequires:  rpmbuild(macros) >= 1.647
48 BuildRequires:  zlib-devel
49 Requires(post,preun):   /sbin/chkconfig
50 Requires(postun):       /usr/sbin/groupdel
51 Requires(postun):       /usr/sbin/userdel
52 Requires(postun,pre):   /usr/sbin/usermod
53 Requires(pre):  /bin/id
54 Requires(pre):  /usr/bin/getgid
55 Requires(pre):  /usr/sbin/groupadd
56 Requires(pre):  /usr/sbin/useradd
57 Requires(post,preun,postun):    systemd-units >= 38
58 Requires:       systemd-units >= 38
59 Requires(triggerpostun):        sed >= 4.0
60 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
61 Requires:       /usr/sbin/usermod
62 Requires:       rc-scripts >= 0.4.1.23
63 Suggests:       clamav-database
64 Suggests:       crondaemon
65 Provides:       group(clamav)
66 Provides:       user(clamav)
67 Conflicts:      logrotate < 3.7-4
68 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
69
70 %description
71 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
72 especially for e-mail scanning on mail gateways. It provides a number
73 of utilities including a flexible and scalable multi-threaded daemon,
74 a command line scanner and advanced tool for automatic database
75 updates. The core of the package is an anti-virus engine available in
76 a form of shared library.
77
78 Here is a list of the main features:
79 - command-line scanner
80 - fast, multi-threaded daemon with support for on-access scanning
81 - milter interface for sendmail
82 - advanced database updater with support for scripted updates and
83   digital signatures
84 - virus scanner C library
85 - on-access scanning (Linux® and FreeBSD®)
86 - virus database updated multiple times per day (see home page for
87   total number of signatures)
88 - built-in support for various archive formats, including Zip, RAR,
89   Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
90 - built-in support for almost all mail file formats
91 - built-in support for ELF executables and Portable Executable files
92   compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
93   obfuscated with SUE, Y0da Cryptor and others
94 - built-in support for popular document formats including MS Office
95   and MacOffice files, HTML, RTF and PDF
96
97 %description -l pl.UTF-8
98 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
99 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
100 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
101 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
102 napisany w C i zgodny z POSIXem.
103
104 %package libs
105 Summary:        Shared libraries for clamav
106 Summary(pl.UTF-8):      Biblioteki dzielone clamav
107 Group:          Libraries
108
109 %description libs
110 Shared libraries for clamav.
111
112 %description libs -l pl.UTF-8
113 Biblioteki dzielone clamav.
114
115 %package milter
116 Summary:        ClamAV filter using milter interface
117 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
118 Group:          Daemons
119 Requires:       %{name} = %{epoch}:%{version}-%{release}
120 Requires:       postfix
121 #Requires:      sendmail >= 8.11
122 Requires:       tcp_wrappers
123
124 %description milter
125 ClamAV sendmail filter using MILTER interface.
126
127 %description milter -l pl.UTF-8
128 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
129
130 %package devel
131 Summary:        clamav - Development header files and libraries
132 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
133 Group:          Development/Libraries
134 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
135 Requires:       bzip2-devel
136 Requires:       curl-devel
137 Requires:       gmp-devel
138 Requires:       openssl-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 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
219
220 cp -p %{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}/clamsubmit
322 %attr(755,root,root) %{_bindir}/freshclam
323 %attr(755,root,root) %{_bindir}/sigtool
324 %attr(755,root,root) %{_bindir}/clamconf
325 %attr(755,root,root) %{_sbindir}/clamd
326 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
327 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
328 %{systemdtmpfilesdir}/%{name}.conf
329 %{systemdunitdir}/clamd.service
330 %attr(755,clamav,root) %dir /var/lib/%{name}
331 %attr(640,clamav,root) %ghost /var/log/freshclam.log
332 %attr(750,clamav,clamav) %dir /var/run/%{name}
333
334 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
335 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
336 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
337
338 %attr(754,root,root) /etc/rc.d/init.d/clamd
339 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
340 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
341 %{_mandir}/man[15]/*
342 %{_mandir}/man8/clamd*
343
344 %if %{with milter}
345 %files milter
346 %defattr(644,root,root,755)
347 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
348 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
349 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
350 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
351 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
352 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
353 %attr(755,root,root) %{_sbindir}/clamav-milter
354 %{_mandir}/man8/clamav-milter.8*
355 %attr(700,clamav,clamav) /var/spool/clamav
356 %endif
357
358 %files libs
359 %defattr(644,root,root,755)
360 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
361 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
362 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
363 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
364 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
365 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
366
367 %files devel
368 %defattr(644,root,root,755)
369 %attr(755,root,root) %{_bindir}/clamav-config
370 %attr(755,root,root) %{_libdir}/libclamav.so
371 %attr(755,root,root) %{_libdir}/libclamunrar.so
372 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
373 %{_libdir}/libclamav.la
374 %{_libdir}/libclamunrar.la
375 %{_libdir}/libclamunrar_iface.la
376 %{_includedir}/clamav.h
377 %{_pkgconfigdir}/libclamav.pc
378
379 %files static
380 %defattr(644,root,root,755)
381 %{_libdir}/libclamav.a
382 %{_libdir}/libclamunrar.a
383 %{_libdir}/libclamunrar_iface.a