]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- fatal errors are not warnings
[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:        5
13 Epoch:          0
14 License:        GPL
15 Group:          Applications
16 Source0:        http://heanet.dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
17 # Source0-md5:  59bf21e169a35d7e9c27a34435f9b870
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:  cee37166f11f509143d61b0e9d3cfeff
28 # Source6-size: 100250
29 Source7:        http://db.local.clamav.net/main.cvd
30 # Source7-md5:  f006a1f55722c2ff9d50e61cfb938bc7
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 +4064 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 "Error: 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 "Error: 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         %userremove clamav
277         %groupremove clamav
278 fi
279
280 %triggerpostun -- %{name} <= 0.75.1
281 if [ -f /etc/clamav.conf.rpmsave ]; then
282         echo "Renaming config to new name /etc/clamd.conf"
283         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
284         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
285         echo "Changing config location in freshclam config"
286         sed -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
287 fi
288
289 %if %{with milter}
290 %post milter
291 /sbin/chkconfig --add clamav-milter
292 if [ -f /var/lock/subsys/clamav-milter ]; then
293         /etc/rc.d/init.d/clamd restart >&2
294 else
295         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
296 fi
297
298 %preun milter
299 if [ "$1" = "0" ]; then
300         if [ -f /var/lock/subsys/clamav-milter ]; then
301                 /etc/rc.d/init.d/clamav-milter stop
302         fi
303         /sbin/chkconfig --del clamav-milter
304 fi
305 %endif
306 %post   libs -p /sbin/ldconfig
307 %postun libs -p /sbin/ldconfig
308
309 %post   database -p %{_sbindir}/%{name}-post-updatedb
310
311 %files
312 %defattr(644,root,root,755)
313 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
314 %attr(755,root,root) %{_bindir}/clamdscan
315 %attr(755,root,root) %{_bindir}/clamscan
316 %attr(755,root,root) %{_bindir}/freshclam
317 %attr(755,root,root) %{_bindir}/sigtool
318 %attr(755,root,root) %{_sbindir}/clamd
319 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
320 %attr(755,clamav,root) %dir /var/lib/%{name}
321 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
322 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
323
324 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
325 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamd.conf
326 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
327
328 %attr(754,root,root) /etc/rc.d/init.d/clamd
329 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
330 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
331 %{_mandir}/man[15]/*
332 %{_mandir}/man8/clamd*
333
334 %if %{with milter}
335 %files milter
336 %defattr(644,root,root,755)
337 %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter
338 %attr(755,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
351 %files devel
352 %defattr(644,root,root,755)
353 %attr(755,root,root) %{_bindir}/clamav-config
354 %attr(755,root,root) %{_libdir}/lib*.so
355 %{_libdir}/lib*.la
356 %{_includedir}/*.h
357 %{_pkgconfigdir}/*.pc
358
359 %files static
360 %defattr(644,root,root,755)
361 %{_libdir}/*.a
362
363 %files database
364 %defattr(644,root,root,755)
365 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
366 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.067577 seconds and 4 git commands to generate.