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