]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- up to 0.86.2
[packages/clamav.git] / clamav.spec
1 # TODO:
2 #   Make freshclam (script and daemon)
3 #
4 # Conditional build:
5 %bcond_without  milter          # build without milter subpackage
6 %bcond_without  database        # build without databases subpackage
7 %bcond_with     curl            # enable curl support
8 #
9 Summary:        An anti-virus utility for Unix
10 Summary(pl):    Narzêdzie antywirusowe dla Uniksów
11 Name:           clamav
12 Version:        0.86.2
13 Release:        1
14 Epoch:          0
15 License:        GPL
16 Group:          Applications
17 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
18 # Source0-md5:  870de14ba123d6e9cba9850498c49f5d
19 Source1:        %{name}.init
20 Source2:        %{name}.sysconfig
21 Source3:        %{name}-milter.init
22 Source4:        %{name}-cron-updatedb
23 Source5:        %{name}.logrotate
24 %if %{with database}
25 # Remember to update date after databases upgrade
26 %define         database_version        20050725
27 Source6:        http://db.local.clamav.net/daily.cvd
28 # Source6-md5:  f39e1d7db36c0318909588e8d43593f8
29 Source7:        http://db.local.clamav.net/main.cvd
30 # Source7-md5:  b98a3007c9f7c4db172590bfb2f084a8
31 Source8:        %{name}-post-updatedb
32 %endif # database
33 Source9:        %{name}-milter.sysconfig
34 Patch0:         %{name}-pld_config.patch
35 Patch1:         %{name}-no_auto_libwrap.patch
36 Patch2:         %{name}-nolibs.patch
37 URL:            http://www.clamav.net/
38 BuildRequires:  autoconf
39 BuildRequires:  automake
40 BuildRequires:  bzip2-devel
41 %{?with_curl:BuildRequires:     curl-devel}
42 BuildRequires:  gmp-devel
43 %{?with_milter:BuildRequires:   libwrap-devel}
44 BuildRequires:  libtool
45 BuildRequires:  rpmbuild(macros) >= 1.202
46 %{?with_milter:BuildRequires:   sendmail-devel >= 8.11}
47 BuildRequires:  zlib-devel
48 PreReq:         rc-scripts
49 Requires(pre):  %{__id}
50 Requires(pre):  /usr/bin/getgid
51 Requires(pre):  /usr/sbin/groupadd
52 Requires(pre):  /usr/sbin/useradd
53 Requires(postun):       /usr/sbin/groupdel
54 Requires(postun):       /usr/sbin/userdel
55 Requires(postun):       sed >= 4.0
56 Requires(postun,pre):   /usr/sbin/usermod
57 Requires(post,preun):   /sbin/chkconfig
58 Requires:       /usr/sbin/usermod
59 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
60 Requires:       bc
61 Provides:       group(clamav)
62 Provides:       user(clamav)
63 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64
65 %description
66 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
67 AMaViS, compressed files, on-access scanning and includes a program
68 for auto-updating with support for digital signatures. The virus
69 database has over 34000 viruses, worms and trojans signatures. The
70 scanner is multithreaded, written in C, and POSIX compliant.
71
72 %description -l pl
73 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
74 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
75 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
76 Baza wirusów zawiera ponad 34000 sygnatur. Skaner jest wielow±tkowy,
77 napisany w C i zgodny z POSIXem.
78
79 %package libs
80 Summary:        Shared libraries for clamav
81 Summary(pl):    Biblioteki dzielone clamav
82 Group:          Libraries
83
84 %description libs
85 Shared libraries for clamav.
86
87 %description libs -l pl
88 Biblioteki dzielone clamav.
89
90 %package milter
91 Summary:        ClamAV filter using milter interface
92 Summary(pl):    Filtr ClamAV korzystaj±cy z interfejsu milter
93 Group:          Daemons
94 Requires:       %{name} = %{epoch}:%{version}-%{release}
95 Requires:       sendmail >= 8.11
96 Requires:       tcp_wrappers
97
98 %description milter
99 ClamAV sendmail filter using MILTER interface.
100
101 %description milter -l pl
102 Filtr ClamAV dla sendmaila korzystaj±cy z interfejsu MILTER.
103
104 %package devel
105 Summary:        clamav - Development header files and libraries
106 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
107 Group:          Development/Libraries
108 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
109 Requires:       bzip2-devel
110 Requires:       gmp-devel
111 Requires:       zlib-devel
112
113 %description devel
114 This package contains the development header files and libraries
115 necessary to develop clamav client applications.
116
117 %description devel -l pl
118 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
119 klienckich clamav.
120
121 %package static
122 Summary:        clamav static libraris
123 Summary(pl):    Biblioteki statyczne clamav
124 Group:          Development/Libraries
125 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
126
127 %description static
128 clamav static libraries.
129
130 %description static -l pl
131 Biblioteki statyczne clamav.
132
133 %package database
134 Summary:        Virus database for clamav
135 Summary(pl):    Bazy wirusów dla clamav
136 Group:          Applications
137 Version:        %{version}.%{database_version}
138 PreReq:         %{name}
139
140 %description database
141 Virus database for clamav (updated %{database_version}).
142
143 %description database -l pl
144 Bazy wirusów dla clamav (aktualizowana %{database_version}).
145
146 %prep
147 %setup -q
148 %patch0 -p1
149 %patch1 -p1
150 %patch2 -p1
151
152 # kill old libtool.m4 copy
153 head -n 489 acinclude.m4 > acinclude.m4.tmp
154 tail -n +4089 acinclude.m4 >> acinclude.m4.tmp
155 mv -f acinclude.m4.tmp acinclude.m4
156
157 %build
158 %{__libtoolize}
159 %{__aclocal}
160 %{__autoconf}
161 %{__autoheader}
162 %{__automake}
163 %configure \
164         --disable-clamav \
165         %{!?with_curl:--without-libcurl} \
166         %{?with_milter:--enable-milter} \
167         --with-dbdir=/var/lib/%{name}
168 %{__make}
169
170 %install
171 rm -rf $RPM_BUILD_ROOT
172 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
173         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav}
174
175 %{__make} install \
176         DESTDIR=$RPM_BUILD_ROOT
177 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
178
179 cat <<EOF >$RPM_BUILD_ROOT/etc/cron.d/%{name}
180 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
181 EOF
182
183 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
184 %if %{with milter}
185 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
186 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
187 %endif
188 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
189 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
190 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
191 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
192
193 %if %{with database}
194 install %{SOURCE6} $RPM_BUILD_ROOT/var/lib/%{name}
195 install %{SOURCE7} $RPM_BUILD_ROOT/var/lib/%{name}
196 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
197 %else
198 rm -f $RPM_BUILD_ROOT/var/lib/%{name}/{main,daily}.cvd
199 %endif
200
201 # NOTE: clamd uses sane rights to it's clamd.pid file
202 # So better keep it dir
203 # If it is fixed use of dir will be unecesary
204 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
205
206 :> $RPM_BUILD_ROOT%{_var}/log/freshclam.log
207
208 %clean
209 rm -rf $RPM_BUILD_ROOT
210
211 %triggerin -- amavis-ng
212 AMAVIS=$(/usr/bin/getgid amavis)
213 RESULT=$?
214 if [ $RESULT -eq 0 ]; then
215         echo "Adding clamav to amavis group GID=$AMAVIS"
216         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
217 fi
218
219 %triggerin -- amavisd-new
220 AMAVIS=$(/usr/bin/getgid amavis)
221 RESULT=$?
222 if [ $RESULT -eq 0 ]; then
223         echo "Adding clamav to amavis group GID=$AMAVIS"
224         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
225 fi
226
227 %triggerin -- amavisd
228 AMAVIS=$(/usr/bin/getgid amavis)
229 RESULT=$?
230 if [ $RESULT -eq 0 ]; then
231         echo "Adding clamav to amavis group GID=$AMAVIS"
232         /usr/sbin/usermod -G amavis clamav 1>&2
233 fi
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 # FIXME: check this. is it proper after useradd macro?
240 # TODO: use addusertogroup macro?
241 if [ -n "`/usr/bin/getgid amavis`" ]; then
242         echo "Adding clamav to amavis group"
243         /usr/sbin/usermod -G amavis clamav 1>&2
244 fi
245
246 %post
247 /sbin/chkconfig --add clamd
248 if [ -f /var/lock/subsys/clamd ]; then
249         /etc/rc.d/init.d/clamd restart >&2
250 else
251         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
252 fi
253 touch %{_var}/log/freshclam.log
254 chown clamav:root %{_var}/log/freshclam.log
255 chmod 640 %{_var}/log/freshclam.log
256
257 %preun
258 if [ "$1" = "0" ]; then
259         if [ -f /var/lock/subsys/clamd ]; then
260                 /etc/rc.d/init.d/clamd stop
261         fi
262         /sbin/chkconfig --del clamd
263 fi
264
265 %postun
266 if [ "$1" = "0" ]; then
267         %userremove clamav
268         %groupremove clamav
269 fi
270
271 %triggerpostun -- %{name} <= 0.75.1
272 if [ -f /etc/clamav.conf.rpmsave ]; then
273         echo "Renaming config to new name /etc/clamd.conf"
274         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
275         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
276         echo "Changing config location in freshclam config"
277         sed -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
278 fi
279
280 %if %{with milter}
281 %post milter
282 /sbin/chkconfig --add clamav-milter
283 if [ -f /var/lock/subsys/clamav-milter ]; then
284         /etc/rc.d/init.d/clamd restart >&2
285 else
286         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
287 fi
288
289 %preun milter
290 if [ "$1" = "0" ]; then
291         if [ -f /var/lock/subsys/clamav-milter ]; then
292                 /etc/rc.d/init.d/clamav-milter stop
293         fi
294         /sbin/chkconfig --del clamav-milter
295 fi
296 %endif
297 %post   libs -p /sbin/ldconfig
298 %postun libs -p /sbin/ldconfig
299
300 %{?with_database:%post  database -p %{_sbindir}/%{name}-post-updatedb}
301
302 %files
303 %defattr(644,root,root,755)
304 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/*.pdf
305 %attr(755,root,root) %{_bindir}/clamdscan
306 %attr(755,root,root) %{_bindir}/clamscan
307 %attr(755,root,root) %{_bindir}/freshclam
308 %attr(755,root,root) %{_bindir}/sigtool
309 %attr(755,root,root) %{_sbindir}/clamd
310 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
311 %attr(755,clamav,root) %dir /var/lib/%{name}
312 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
313 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
314
315 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
316 %attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
317 %attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
318
319 %attr(754,root,root) /etc/rc.d/init.d/clamd
320 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
321 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
322 %{_mandir}/man[15]/*
323 %{_mandir}/man8/clamd*
324
325 %if %{with milter}
326 %files milter
327 %defattr(644,root,root,755)
328 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
329 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
330 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
331 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
332 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
333 %attr(755,root,root) %{_sbindir}/clamav-milter
334 %{_mandir}/man8/clamav-milter.8*
335 %attr(700,clamav,clamav) /var/spool/clamav/
336 %endif
337
338 %files libs
339 %defattr(644,root,root,755)
340 %attr(755,root,root) %{_libdir}/lib*.so.*.*
341
342 %files devel
343 %defattr(644,root,root,755)
344 %attr(755,root,root) %{_bindir}/clamav-config
345 %attr(755,root,root) %{_libdir}/lib*.so
346 %{_libdir}/lib*.la
347 %{_includedir}/*.h
348 %{_pkgconfigdir}/*.pc
349
350 %files static
351 %defattr(644,root,root,755)
352 %{_libdir}/*.a
353
354 %if %{with database}
355 %files database
356 %defattr(644,root,root,755)
357 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
358 %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/%{name}/*.cvd
359 %endif # database
This page took 0.0934 seconds and 4 git commands to generate.