]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- up to 0.97.8
[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          # build without milter subpackage
7 %if "%{pld_release}" == "ac"
8 %bcond_with             llvm            # build without llvm support
9 %else
10 %bcond_without  llvm            # build without 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.97.8
17 Release:        1
18 License:        GPL v2+
19 Group:          Daemons
20 Source0:        http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
21 # Source0-md5:  ac52bcbad3ea72eac08fedb9772f648b
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 %{?with_milter:BuildRequires:   libwrap-devel}
45 %{?with_llvm:BuildRequires:     llvm-devel}
46 BuildRequires:  ncurses-devel
47 BuildRequires:  rpm >= 4.4.9-56
48 BuildRequires:  rpmbuild(macros) >= 1.647
49 BuildRequires:  zlib-devel
50 Requires(post,preun):   /sbin/chkconfig
51 Requires(postun):       /usr/sbin/groupdel
52 Requires(postun):       /usr/sbin/userdel
53 Requires(postun,pre):   /usr/sbin/usermod
54 Requires(pre):  /bin/id
55 Requires(pre):  /usr/bin/getgid
56 Requires(pre):  /usr/sbin/groupadd
57 Requires(pre):  /usr/sbin/useradd
58 Requires(post,preun,postun):    systemd-units >= 38
59 Requires:       systemd-units >= 38
60 Requires(triggerpostun):        sed >= 4.0
61 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
62 Requires:       /usr/sbin/usermod
63 Requires:       rc-scripts >= 0.4.1.23
64 Suggests:       clamav-database
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:       gmp-devel
137 Requires:       zlib-devel
138
139 %description devel
140 This package contains the development header files and libraries
141 necessary to develop clamav client applications.
142
143 %description devel -l pl.UTF-8
144 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
145 klienckich clamav.
146
147 %package static
148 Summary:        clamav static libraries
149 Summary(pl.UTF-8):      Biblioteki statyczne clamav
150 Group:          Development/Libraries
151 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
152
153 %description static
154 clamav static libraries.
155
156 %description static -l pl.UTF-8
157 Biblioteki statyczne clamav.
158
159 %prep
160 %setup -q
161 %patch0 -p1
162 %patch1 -p1
163 %patch2 -p1
164 %patch3 -p1
165
166 %build
167 # automake 1.12+ needs configure.ac not .in
168 mv configure.{in,ac}
169 %{__libtoolize}
170 %{__aclocal} -I m4
171 %{__autoconf}
172 %{__autoheader}
173 %{__automake}
174 %configure \
175         --disable-clamav \
176         %{?with_milter:--enable-milter} \
177         --with-dbdir=/var/lib/%{name} \
178         --with-no-cache \
179         --with-ltdl-include=%{_includedir} \
180         --with-ltdl-lib=%{_libdir}
181
182 %{__make} \
183         LIBTOOL=%{_bindir}/libtool
184
185 %install
186 rm -rf $RPM_BUILD_ROOT
187 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
188         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
189         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
190         $RPM_BUILD_ROOT%{systemdunitdir}
191
192 %{__make} install \
193         LIBTOOL=%{_bindir}/libtool \
194         DESTDIR=$RPM_BUILD_ROOT
195 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
196
197 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
198 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
199 EOF
200
201 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
202 %if %{with milter}
203 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
204 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
205 %endif
206 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
207 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
208 cp -p etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
209 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
210
211 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
212
213 install %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
214
215 install %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
216
217 # NOTE: clamd uses sane rights to it's clamd.pid file
218 # So better keep it dir
219 # If it is fixed use of dir will be unecesary
220 install -d $RPM_BUILD_ROOT/var/run/%{name}
221
222 :> $RPM_BUILD_ROOT/var/log/freshclam.log
223
224 %clean
225 rm -rf $RPM_BUILD_ROOT
226
227 %triggerin -- amavis-ng
228 %addusertogroup -q clamav amavis
229
230 %triggerin -- amavisd-new
231 %addusertogroup -q clamav amavis
232
233 %triggerin -- amavisd
234 %addusertogroup -q clamav amavis
235
236 %pre
237 %groupadd -g 43 clamav
238 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
239
240 %post
241 /sbin/chkconfig --add clamd
242 %service clamd restart "Clam Antivirus daemon"
243 touch /var/log/freshclam.log
244 chown clamav:root /var/log/freshclam.log
245 chmod 640 /var/log/freshclam.log
246 %systemd_post clamd.service
247
248 %preun
249 if [ "$1" = "0" ]; then
250         %service clamd stop
251         /sbin/chkconfig --del clamd
252 fi
253 %systemd_preun clamd.service
254
255 %postun
256 if [ "$1" = "0" ]; then
257         %userremove clamav
258         %groupremove clamav
259 fi
260 %systemd_reload
261
262 %triggerpostun -- %{name} < 0.80
263 if [ -f /etc/clamav.conf.rpmsave ]; then
264         echo "Renaming config to new name /etc/clamd.conf"
265         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
266         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
267         echo "Changing config location in freshclam config"
268         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
269 fi
270
271 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
272 %{__cp} -f /etc/clamd.conf{,.rpmsave}
273 %{__sed} -i -e '
274                 s,^LogSyslog$,& yes,
275                 s,^FixStaleSocket$,& yes,
276                 s,^AllowSupplementaryGroups$,& yes,
277                 s,^ClamukoScanOnOpen$,& yes,
278                 s,^ClamukoScanOnClose$,& yes,
279                 s,^ClamukoScanOnExec$,& yes,
280                 s,^LogTime$,& yes,
281                 s,^ScanPE$,& yes,
282 ' /etc/clamd.conf
283 %banner -e %{name}-0.90 <<EOF
284 ClamAV config was automatically upgraded to 0.90 format. You should review it
285 that it's still valid.
286 EOF
287 #'
288 # unfortunately clamd has no configcheck option so we just have to start it
289 # once again after config was broken after upgrade
290 touch /var/lock/subsys/clamd
291 %service -q clamd restart
292
293 %triggerpostun -- %{name} < 0.97.7-4
294 %systemd_trigger clamd.service
295
296 %post milter
297 /sbin/chkconfig --add clamav-milter
298 %service clamav-milter restart "Clam Antivirus daemon"
299
300 %preun milter
301 if [ "$1" = "0" ]; then
302         %service clamav-milter stop
303         /sbin/chkconfig --del clamav-milter
304 fi
305
306 %post   libs -p /sbin/ldconfig
307 %postun libs -p /sbin/ldconfig
308
309 %files
310 %defattr(644,root,root,755)
311 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
312 %attr(755,root,root) %{_bindir}/clambc
313 %attr(755,root,root) %{_bindir}/clamdscan
314 %attr(755,root,root) %{_bindir}/clamdtop
315 %attr(755,root,root) %{_bindir}/clamscan
316 %attr(755,root,root) %{_bindir}/freshclam
317 %attr(755,root,root) %{_bindir}/sigtool
318 %attr(755,root,root) %{_bindir}/clamconf
319 %attr(755,root,root) %{_sbindir}/clamd
320 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
321 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
322 %{systemdtmpfilesdir}/%{name}.conf
323 %{systemdunitdir}/clamd.service
324 %attr(755,clamav,root) %dir /var/lib/%{name}
325 %attr(640,clamav,root) %ghost /var/log/freshclam.log
326 %attr(750,clamav,clamav) %dir /var/run/%{name}
327
328 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
329 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
330 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
331
332 %attr(754,root,root) /etc/rc.d/init.d/clamd
333 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
334 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
335 %{_mandir}/man[15]/*
336 %{_mandir}/man8/clamd*
337
338 %if %{with milter}
339 %files milter
340 %defattr(644,root,root,755)
341 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
342 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
343 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
344 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
345 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
346 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
347 %attr(755,root,root) %{_sbindir}/clamav-milter
348 %{_mandir}/man8/clamav-milter.8*
349 %attr(700,clamav,clamav) /var/spool/clamav
350 %endif
351
352 %files libs
353 %defattr(644,root,root,755)
354 %attr(755,root,root) %{_libdir}/lib*.so.*.*
355 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
356 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
357 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
358
359 %files devel
360 %defattr(644,root,root,755)
361 %attr(755,root,root) %{_bindir}/clamav-config
362 %attr(755,root,root) %{_libdir}/lib*.so
363 %{_libdir}/lib*.la
364 %{_includedir}/*.h
365 %{_pkgconfigdir}/*.pc
366
367 %files static
368 %defattr(644,root,root,755)
369 %{_libdir}/*.a
This page took 0.080839 seconds and 4 git commands to generate.