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