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