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