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