1 |
%define major 6 |
2 |
%define libname %mklibname %{name} %{major} |
3 |
%define develname %mklibname %{name} -d |
4 |
|
5 |
%define milter 1 |
6 |
|
7 |
%{?_with_milter: %{expand: %%global milter 1}} |
8 |
%{?_without_milter: %{expand: %%global milter 0}} |
9 |
|
10 |
|
11 |
Summary: An anti-virus utility for Unix |
12 |
Name: clamav |
13 |
Version: 0.97.7 |
14 |
Release: %mkrel 3 |
15 |
License: GPL |
16 |
Group: Security |
17 |
URL: http://clamav.sourceforge.net/ |
18 |
#Source1: http://downloads.sourceforge.net/clamav/clamav-%{version}.tar.gz.sig |
19 |
# clamav-0.95+ bundles support for RAR v3 in "libclamav" without permission, |
20 |
# from Eugene Roshal of RARlabs. There is also patent issues involved. |
21 |
# |
22 |
# https://bugzilla.redhat.com/show_bug.cgi?id=334371 |
23 |
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312552 |
24 |
# |
25 |
# Both Redhat and debian removes this code from the upstream tar ball |
26 |
# and repackages it. |
27 |
Source0: %{name}-%{version}-norar.tar.gz |
28 |
Source2: clamav-clamd.init |
29 |
Source3: clamav-clamd.logrotate |
30 |
Source4: clamav-freshclamd.init |
31 |
Source5: clamav-freshclam.logrotate |
32 |
Source6: clamav-milter.init |
33 |
Source7: clamav-milter.sysconfig |
34 |
Source8: clamav-milter.logrotate |
35 |
Source9: clamav-clamd.sysconfig |
36 |
Source10: clamav-freshclam.sysconfig |
37 |
Source11: http://db.local.clamav.net/main-54.cvd |
38 |
Source12: http://db.local.clamav.net/daily-16853.cvd |
39 |
Patch0: clamav-mga_conf.patch |
40 |
Patch1: clamav-0.95-linkage_fix.diff |
41 |
Patch2: clamav-0.97-build_fix.diff |
42 |
Patch10: clamav-0.97.2-private.patch |
43 |
Patch11: clamav-0.92-open.patch |
44 |
Patch12: clamav-0.95-cliopts.patch |
45 |
Patch13: clamav-0.95rc1-umask.patch |
46 |
Requires(post): clamav-db |
47 |
Requires(preun): clamav-db |
48 |
Requires(post): %{libname} = %{version} |
49 |
Requires(preun): %{libname} = %{version} |
50 |
Requires(post): systemd >= %{systemd_required_version} |
51 |
Requires(post): rpm-helper |
52 |
Requires(preun): rpm-helper |
53 |
Requires(pre): rpm-helper |
54 |
Requires(postun): rpm-helper |
55 |
BuildRequires: bc |
56 |
BuildRequires: bzip2-devel |
57 |
BuildRequires: curl-devel |
58 |
BuildRequires: ncurses-devel |
59 |
BuildRequires: tommath-devel |
60 |
BuildRequires: zlib-devel |
61 |
%if %{milter} |
62 |
BuildRequires: sendmail-devel |
63 |
BuildRequires: tcp_wrappers-devel |
64 |
%endif |
65 |
Conflicts: clamd < 0.91 |
66 |
|
67 |
%description |
68 |
Clam AntiVirus is an anti-virus toolkit for Unix. The main purpose of this |
69 |
software is the integration with mail seversions (attachment scanning). The |
70 |
package provides a flexible and scalable multi-threaded daemon, a commandline |
71 |
scanner, and a tool for automatic updating via Internet. The programs are based |
72 |
on a shared library distributed with the Clam AntiVirus package, which you can |
73 |
use in your own software. |
74 |
|
75 |
You can build %{name} with some conditional build swithes; |
76 |
|
77 |
(ie. use with rpm --rebuild): |
78 |
--with[out] milter Build %{name}-milter (disabled) |
79 |
|
80 |
%package -n clamd |
81 |
Summary: The Clam AntiVirus Daemon |
82 |
Group: Security |
83 |
Requires: %{name} = %{version} |
84 |
Requires(post): clamav-db |
85 |
Requires(preun): clamav-db |
86 |
Requires(post): %{libname} = %{version} |
87 |
Requires(preun): %{libname} = %{version} |
88 |
Requires(post): rpm-helper |
89 |
Requires(preun): rpm-helper |
90 |
Requires(pre): rpm-helper |
91 |
Requires(postun): rpm-helper |
92 |
|
93 |
%description -n clamd |
94 |
The Clam AntiVirus Daemon |
95 |
|
96 |
%if %{milter} |
97 |
%package -n %{name}-milter |
98 |
Summary: The Clam AntiVirus milter Daemon |
99 |
Group: Security |
100 |
Requires: %{name} = %{version} |
101 |
Requires: clamd = %{version} |
102 |
Requires: tcp_wrappers |
103 |
Requires(post): clamav-db |
104 |
Requires(preun): clamav-db |
105 |
Requires(post): %{libname} = %{version} |
106 |
Requires(preun): %{libname} = %{version} |
107 |
Requires(post): rpm-helper |
108 |
Requires(preun): rpm-helper |
109 |
Requires(pre): rpm-helper |
110 |
Requires(postun): rpm-helper |
111 |
|
112 |
%description -n %{name}-milter |
113 |
The Clam AntiVirus milter Daemon |
114 |
%endif |
115 |
|
116 |
%package -n %{name}-db |
117 |
Summary: Virus database for %{name} |
118 |
Group: Security |
119 |
Requires: %{name} = %{version} |
120 |
Requires(post): rpm-helper |
121 |
Requires(preun): rpm-helper |
122 |
Requires(pre): rpm-helper |
123 |
Requires(postun): rpm-helper |
124 |
BuildArch: noarch |
125 |
|
126 |
%description -n %{name}-db |
127 |
The actual virus database for %{name} |
128 |
|
129 |
%package -n %{libname} |
130 |
Summary: Shared libraries for %{name} |
131 |
Group: System/Libraries |
132 |
|
133 |
%description -n %{libname} |
134 |
Shared libraries for %{name} |
135 |
|
136 |
%package -n %{develname} |
137 |
Summary: Development library and header files for the %{name} library |
138 |
Group: Development/C |
139 |
Requires: %{libname} = %{version} |
140 |
Provides: %{name}-devel = %{version}-%{release} |
141 |
Obsoletes: %{name}-devel |
142 |
Obsoletes: %{mklibname clamav 1 -d} |
143 |
Obsoletes: %{mklibname clamav 2 -d} |
144 |
Obsoletes: %{mklibname clamav 3 -d} |
145 |
|
146 |
%description -n %{develname} |
147 |
This package contains the static %{libname} library and its header |
148 |
files. |
149 |
|
150 |
%prep |
151 |
|
152 |
%setup -q -n %{name}-%{version} |
153 |
|
154 |
# clean up |
155 |
for i in `find . -type d -name CVS` `find . -type f -name .cvs\*` `find . -type f -name .#\*` `find . -type d -name .svn`; do |
156 |
if [ -e "$i" ]; then rm -rf $i; fi >&/dev/null |
157 |
done |
158 |
|
159 |
%patch0 -p1 -b .mgaconf |
160 |
%patch1 -p1 -b .linkage_fix |
161 |
%patch2 -p1 -b .build_fix |
162 |
|
163 |
%patch10 -p1 -b .private |
164 |
%patch11 -p1 -b .open |
165 |
%patch12 -p1 -b .cliopts |
166 |
%patch13 -p1 -b .umask |
167 |
|
168 |
# we can't ship libclamunrar |
169 |
if [ -d libclamunrar ]; then |
170 |
echo "delete the libclamunrar directory and repackage the tar ball" |
171 |
exit 1 |
172 |
fi |
173 |
|
174 |
mkdir -p libclamunrar{,_iface} |
175 |
touch libclamunrar/{Makefile.in,all,install} |
176 |
|
177 |
mkdir -p Mageia |
178 |
cp %{SOURCE2} Mageia/clamav-clamd.init |
179 |
cp %{SOURCE3} Mageia/clamav-clamd.logrotate |
180 |
cp %{SOURCE4} Mageia/clamav-freshclamd.init |
181 |
cp %{SOURCE5} Mageia/clamav-freshclam.logrotate |
182 |
cp %{SOURCE6} Mageia/clamav-milter.init |
183 |
cp %{SOURCE7} Mageia/clamav-milter.sysconfig |
184 |
cp %{SOURCE8} Mageia/clamav-milter.logrotate |
185 |
cp %{SOURCE9} Mageia/clamav-clamd.sysconfig |
186 |
cp %{SOURCE10} Mageia/clamav-freshclam.sysconfig |
187 |
|
188 |
%build |
189 |
%serverbuild |
190 |
|
191 |
export CFLAGS="$CFLAGS -I%{_includedir}/tommath" |
192 |
|
193 |
# IPv6 check is buggy and does not work when there are no IPv6 interface on build machine |
194 |
export have_cv_ipv6=yes |
195 |
|
196 |
%configure2_5x \ |
197 |
--localstatedir=/var/lib \ |
198 |
--disable-%{name} \ |
199 |
--with-user=%{name} \ |
200 |
--with-group=%{name} \ |
201 |
--with-dbdir=/var/lib/%{name} \ |
202 |
--disable-rpath \ |
203 |
--disable-unrar \ |
204 |
--enable-clamdtop \ |
205 |
--enable-id-check \ |
206 |
--enable-clamuko \ |
207 |
--enable-bigstack \ |
208 |
--with-zlib=%{_prefix} \ |
209 |
--with-libbz2-prefix=%{_prefix} \ |
210 |
--with-system-tommath \ |
211 |
%if %{milter} |
212 |
--enable-milter --with-tcpwrappers \ |
213 |
%else |
214 |
--disable-milter --without-tcpwrappers \ |
215 |
%endif |
216 |
|
217 |
# anti rpath hack |
218 |
perl -pi -e "s|^sys_lib_dlsearch_path_spec=.*|sys_lib_dlsearch_path_spec=\"/%{_lib} %{_libdir}\"|g" libtool |
219 |
|
220 |
%make |
221 |
|
222 |
%install |
223 |
rm -rf %{buildroot} |
224 |
|
225 |
%makeinstall_std |
226 |
|
227 |
# install the init scripts |
228 |
install -d %{buildroot}%{_initrddir} |
229 |
install -m755 Mageia/clamav-clamd.init %{buildroot}%{_initrddir}/clamd |
230 |
install -m755 Mageia/clamav-freshclamd.init %{buildroot}%{_initrddir}/freshclam |
231 |
|
232 |
# install the virus-db files |
233 |
install -D -m 0644 -p %SOURCE11 %{buildroot}/var/lib/%{name}/main.cvd |
234 |
install -D -m 0644 -p %SOURCE12 %{buildroot}/var/lib/%{name}/daily.cvd |
235 |
|
236 |
%if %{milter} |
237 |
# install the init script |
238 |
install -m755 Mageia/clamav-milter.init %{buildroot}%{_initrddir}/clamav-milter |
239 |
# install the milter config |
240 |
install -d %{buildroot}%{_sysconfdir}/sysconfig |
241 |
install -m644 Mageia/clamav-milter.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}-milter |
242 |
%endif |
243 |
|
244 |
# install config files |
245 |
install -d %{buildroot}%{_sysconfdir}/sysconfig |
246 |
install -m0644 Mageia/clamav-clamd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/clamd |
247 |
install -m0644 Mageia/clamav-freshclam.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/freshclam |
248 |
|
249 |
# install the logrotate stuff |
250 |
install -d %{buildroot}%{_sysconfdir}/logrotate.d |
251 |
install -m644 Mageia/clamav-clamd.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/clamd |
252 |
install -m644 Mageia/clamav-freshclam.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/freshclam |
253 |
|
254 |
%if %{milter} |
255 |
install -m644 Mageia/clamav-milter.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/clamav-milter |
256 |
%endif |
257 |
|
258 |
install -d %{buildroot}%{_var}/log/%{name} |
259 |
touch %{buildroot}%{_var}/log/%{name}/freshclam.log |
260 |
touch %{buildroot}%{_var}/log/%{name}/clamd.log |
261 |
|
262 |
%if %{milter} |
263 |
touch %{buildroot}%{_var}/log/%{name}/clamav-milter.log |
264 |
%endif |
265 |
|
266 |
# install config files |
267 |
install -m644 etc/clamd.conf %{buildroot}%{_sysconfdir}/clamd.conf |
268 |
install -m644 etc/freshclam.conf %{buildroot}%{_sysconfdir}/freshclam.conf |
269 |
|
270 |
# fix TMPDIR |
271 |
install -d %{buildroot}/var/lib/%{name}/tmp |
272 |
|
273 |
mkdir -p %{buildroot}%{_tmpfilesdir} |
274 |
cat <<EOF > %{buildroot}%{_tmpfilesdir}/%{name}.conf |
275 |
d /run/clamav 0755 clamav clamav |
276 |
EOF |
277 |
|
278 |
cat > README.qmail+qmail-scanner <<EOF |
279 |
#!/bin/sh |
280 |
# |
281 |
# The "temporary" qmail+qmail-scanner HOWTO |
282 |
# ----------------------------------------- |
283 |
# |
284 |
# For some unknown and undocumented reason clamdscan stopped working |
285 |
# in the excellent qmail+qmail-scanner setup somewhere after the |
286 |
# 20040103 CVS snapshot. |
287 |
# |
288 |
# To get it working again everything assigned to the clamav user has |
289 |
# to be changed to the qscand user by hand. |
290 |
# |
291 |
# Hint: Change the config and chown the directories like this: |
292 |
# (if you are lazy you could just execute this file) |
293 |
|
294 |
perl -pi -e "s|%{name} %{name}|qscand qscand|g" %{_sysconfdir}/logrotate.d/clamd |
295 |
perl -pi -e "s|%{name} %{name}|qscand qscand|g" %{_sysconfdir}/logrotate.d/freshclam |
296 |
perl -pi -e "s|^User %{name}|User qscand|g" %{_sysconfdir}/clamd.conf |
297 |
perl -pi -e "s|^DatabaseOwner %{name}|DatabaseOwner qscand|g" %{_sysconfdir}/freshclam.conf |
298 |
|
299 |
chown -R qscand:qscand /var/lib/%{name} |
300 |
chown -R qscand:qscand %{_var}/log/%{name} |
301 |
chown -R qscand:qscand %{_var}/run/%{name} |
302 |
|
303 |
if [ -x %{_initrddir}/clamd ]; then |
304 |
%{_initrddir}/clamd restart |
305 |
fi |
306 |
|
307 |
if [ -x %{_initrddir}/freshclam ]; then |
308 |
%{_initrddir}/freshclam restart |
309 |
fi |
310 |
|
311 |
# Regards // Oden Eriksson |
312 |
EOF |
313 |
|
314 |
cat > README.urpmi << EOF |
315 |
clamav-0.95+ bundles support for RAR v3 in "libclamav" without permission, |
316 |
from Eugene Roshal of RARlabs. There is also patent issues involved. |
317 |
|
318 |
Therefore Mageia has been forced to remove the offending code. |
319 |
EOF |
320 |
|
321 |
%multiarch_binaries %{buildroot}%{_bindir}/clamav-config |
322 |
|
323 |
%pre |
324 |
%_pre_useradd %{name} /var/lib/%{name} /bin/sh |
325 |
|
326 |
if ! [ -z "`getent group amavis`" ]; then |
327 |
gpasswd -a %{name} amavis |
328 |
fi |
329 |
|
330 |
%post |
331 |
%_tmpfilescreate %{name} |
332 |
%_post_service freshclam |
333 |
%create_ghostfile %{_var}/log/%{name}/freshclam.log %{name} %{name} 0644 |
334 |
|
335 |
%preun |
336 |
%_preun_service freshclam |
337 |
|
338 |
%pre -n clamd |
339 |
%_pre_useradd %{name} /var/lib/%{name} /bin/sh |
340 |
|
341 |
%post -n clamd |
342 |
%_post_service clamd |
343 |
%create_ghostfile %{_var}/log/%{name}/clamd.log %{name} %{name} 0644 |
344 |
|
345 |
%preun -n clamd |
346 |
%_preun_service clamd |
347 |
|
348 |
%postun -n clamd |
349 |
%_postun_userdel %{name} |
350 |
|
351 |
%if %{milter} |
352 |
%post -n %{name}-milter |
353 |
%_post_service %{name}-milter |
354 |
%create_ghostfile %{_var}/log/%{name}/clamav-milter.log %{name} %{name} 0644 |
355 |
|
356 |
%preun -n %{name}-milter |
357 |
%_preun_service %{name}-milter |
358 |
%endif |
359 |
|
360 |
%pre -n %{name}-db |
361 |
%_pre_useradd %{name} /var/lib/%{name} /bin/sh |
362 |
|
363 |
%post -n %{name}-db |
364 |
# try to keep most uptodate database |
365 |
for i in main daily; do |
366 |
if [ -f %{_var}/lib/clamav/$i.cvd.rpmnew ]; then |
367 |
if [ %{_var}/lib/clamav/$i.cvd.rpmnew -nt %{_var}/lib/%{name}/$i.cvd ]; then |
368 |
mv -f %{_var}/lib/clamav/$i.cvd.rpmnew %{_var}/lib/%{name}/$i.cvd |
369 |
else |
370 |
rm -f %{_var}/lib/clamav/$i.cvd.rpmnew |
371 |
fi |
372 |
fi |
373 |
done |
374 |
|
375 |
%postun -n %{name}-db |
376 |
%_postun_userdel %{name} |
377 |
|
378 |
%clean |
379 |
rm -rf %{buildroot} |
380 |
|
381 |
%files |
382 |
%doc AUTHORS BUGS FAQ NEWS README test UPGRADE README.urpmi |
383 |
%doc docs/*.pdf |
384 |
%doc README.qmail+qmail-scanner COPYING* |
385 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/clamd.conf |
386 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/freshclam.conf |
387 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/freshclam |
388 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/freshclam |
389 |
%attr(0755,root,root) %{_initrddir}/freshclam |
390 |
%{_tmpfilesdir}/%{name}.conf |
391 |
%{_bindir}/clambc |
392 |
%{_bindir}/clamconf |
393 |
%{_bindir}/clamdscan |
394 |
%{_bindir}/clamdtop |
395 |
%{_bindir}/clamscan |
396 |
%{_bindir}/freshclam |
397 |
%{_bindir}/sigtool |
398 |
%{_mandir}/man1/clambc.* |
399 |
%{_mandir}/man1/clamconf.1.* |
400 |
%{_mandir}/man1/clamdscan.1* |
401 |
%{_mandir}/man1/clamdtop.1* |
402 |
%{_mandir}/man1/clamscan.1* |
403 |
%{_mandir}/man1/freshclam.1* |
404 |
%{_mandir}/man1/sigtool.1* |
405 |
%{_mandir}/man5/clamd.conf.5* |
406 |
%{_mandir}/man5/freshclam.conf.5* |
407 |
%if !%{milter} |
408 |
%exclude %{_mandir}/man8/%{name}-milter.8* |
409 |
%endif |
410 |
%dir %attr(0755,%{name},%{name}) /var/lib/%{name} |
411 |
%dir %attr(0775,%{name},%{name}) %{_var}/log/%{name} |
412 |
%ghost %attr(0644,%{name},%{name}) %{_var}/log/%{name}/freshclam.log |
413 |
|
414 |
%files -n clamd |
415 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/clamd |
416 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/clamd |
417 |
%attr(0755,root,root) %{_initrddir}/clamd |
418 |
%{_sbindir}/clamd |
419 |
%{_mandir}/man8/clamd.8* |
420 |
%ghost %attr(0644,%{name},%{name}) %{_var}/log/%{name}/clamd.log |
421 |
|
422 |
%if %{milter} |
423 |
%files -n %{name}-milter |
424 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/clamav-milter.conf |
425 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-milter |
426 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/clamav-milter |
427 |
%attr(0755,root,root) %{_initrddir}/%{name}-milter |
428 |
%{_sbindir}/%{name}-milter |
429 |
%{_mandir}/man8/%{name}-milter.8* |
430 |
%{_mandir}/man5/%{name}-milter.conf.5* |
431 |
%ghost %attr(0644,%{name},%{name}) %{_var}/log/%{name}/clamav-milter.log |
432 |
%endif |
433 |
|
434 |
%files -n %{name}-db |
435 |
%dir %attr(0755,%{name},%{name}) /var/lib/%{name} |
436 |
%dir %attr(0755,%{name},%{name}) /var/lib/%{name}/tmp |
437 |
%attr(0644,%{name},%{name}) %config(noreplace) /var/lib/%{name}/daily.cvd |
438 |
%attr(0644,%{name},%{name}) %config(noreplace) /var/lib/%{name}/main.cvd |
439 |
|
440 |
%files -n %{libname} |
441 |
%{_libdir}/*.so.%{major}* |
442 |
|
443 |
%files -n %{develname} |
444 |
%multiarch %{multiarch_bindir}/clamav-config |
445 |
%{_bindir}/clamav-config |
446 |
%{_includedir}/* |
447 |
%{_libdir}/*.so |
448 |
%{_libdir}/*.*a |
449 |
%{_libdir}/pkgconfig/libclamav.pc |