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