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