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