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