]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- rel. 6
[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:        6
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 BuildRequires:  bzip2-devel
42 %{?with_curl:BuildRequires:     curl-devel}
43 BuildRequires:  gmp-devel
44 %{?with_milter:BuildRequires:   libwrap-devel}
45 BuildRequires:  libtool
46 BuildRequires:  rpmbuild(macros) >= 1.159
47 %{?with_milter:BuildRequires:   sendmail-devel >= 8.11}
48 BuildRequires:  zlib-devel
49 Requires(pre):  /bin/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 25000 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 25000 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 -l pl milter
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 %patch3 -p1
152
153 # kill old libtool.m4 copy
154 head -n 489 acinclude.m4 > acinclude.m4.tmp
155 tail -n +4064 acinclude.m4 >> acinclude.m4.tmp
156 mv -f acinclude.m4.tmp acinclude.m4
157
158 %build
159 %{__libtoolize}
160 %{__aclocal}
161 %{__autoconf}
162 %{__autoheader}
163 %{__automake}
164 %configure \
165         --disable-clamav \
166         %{!?with_curl:--without-libcurl} \
167         %{?with_milter:--enable-milter} \
168         --with-dbdir=/var/lib/%{name}
169 %{__make}
170
171 %install
172 rm -rf $RPM_BUILD_ROOT
173 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
174         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/{log,spool/clamav}}
175
176 %{__make} install \
177         DESTDIR=$RPM_BUILD_ROOT
178 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
179
180 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
181 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
182 EOF
183
184 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
185 %if %{with milter}
186 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
187 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
188 %endif
189 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
190 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
191 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
192 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
193 install %{SOURCE6} $RPM_BUILD_ROOT/var/lib/%{name}
194 install %{SOURCE7} $RPM_BUILD_ROOT/var/lib/%{name}
195 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
196
197 # NOTE: clamd uses sane rights to it's clamd.pid file
198 # So better keep it dir
199 # If it is fixed use of dir will be unecesary
200 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
201
202 touch $RPM_BUILD_ROOT%{_var}/log/freshclam.log
203
204 %clean
205 rm -rf $RPM_BUILD_ROOT
206
207 %triggerin -- amavis-ng
208 AMAVIS=$(/usr/bin/getgid amavis)
209 RESULT=$?
210 if [ $RESULT -eq 0 ]; then
211         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
212         echo "adding clamav to amavis group GID=$AMAVIS"
213 fi
214
215 %triggerin -- amavisd-new
216 AMAVIS=$(/usr/bin/getgid amavis)
217 RESULT=$?
218 if [ $RESULT -eq 0 ]; then
219         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
220         echo "adding clamav to amavis group GID=$AMAVIS"
221 fi
222
223 %triggerin -- amavisd
224 AMAVIS=$(/usr/bin/getgid amavis)
225 RESULT=$?
226 if [ $RESULT -eq 0 ]; then
227         echo "adding clamav to amavis group GID=$AMAVIS"
228         /usr/sbin/usermod -G amavis clamav 1>&2
229 fi
230
231 %pre
232 if [ -n "`/usr/bin/getgid clamav`" ]; then
233         if [ "`/usr/bin/getgid clamav`" != 43 ]; then
234                 echo "Error: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
235                 exit 1
236         fi
237 else
238         echo "Adding group clamav GID=43"
239         /usr/sbin/groupadd -g 43 clamav
240 fi
241 if [ -n "`/bin/id -u clamav 2>/dev/null`" ]; then
242         if [ "`/bin/id -u clamav`" != 43 ]; then
243                 echo "Error: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
244                 exit 1
245         fi
246 else
247         echo "Adding user clamav UID=43"
248         /usr/sbin/useradd -u 43 -d /tmp -s /bin/false \
249                 -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
250         if [ -n "`/usr/bin/getgid amavis`" ]; then
251                 echo "adding clamav to amavis group"
252                 /usr/sbin/usermod -G amavis clamav 1>&2
253         fi
254 fi
255
256 %post
257 /sbin/chkconfig --add clamd
258 if [ -f /var/lock/subsys/clamd ]; then
259         /etc/rc.d/init.d/clamd restart >&2
260 else
261         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
262 fi
263 touch %{_var}/log/freshclam.log
264 chown clamav:root %{_var}/log/freshclam.log
265 chmod 640 %{_var}/log/freshclam.log
266
267 %preun
268 if [ "$1" = "0" ]; then
269         if [ -f /var/lock/subsys/clamd ]; then
270                 /etc/rc.d/init.d/clamd stop
271         fi
272         /sbin/chkconfig --del clamd
273 fi
274
275 %postun
276 if [ "$1" = "0" ]; then
277         %userremove clamav
278         %groupremove clamav
279 fi
280
281 %triggerpostun -- %{name} <= 0.75.1
282 if [ -f /etc/clamav.conf.rpmsave ]; then
283         echo "Renaming config to new name /etc/clamd.conf"
284         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
285         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
286         echo "Changing config location in freshclam config"
287         sed -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
288 fi
289
290 %if %{with milter}
291 %post milter
292 /sbin/chkconfig --add clamav-milter
293 if [ -f /var/lock/subsys/clamav-milter ]; then
294         /etc/rc.d/init.d/clamd restart >&2
295 else
296         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
297 fi
298
299 %preun milter
300 if [ "$1" = "0" ]; then
301         if [ -f /var/lock/subsys/clamav-milter ]; then
302                 /etc/rc.d/init.d/clamav-milter stop
303         fi
304         /sbin/chkconfig --del clamav-milter
305 fi
306 %endif
307 %post   libs -p /sbin/ldconfig
308 %postun libs -p /sbin/ldconfig
309
310 %post   database -p %{_sbindir}/%{name}-post-updatedb
311
312 %files
313 %defattr(644,root,root,755)
314 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
315 %attr(755,root,root) %{_bindir}/clamdscan
316 %attr(755,root,root) %{_bindir}/clamscan
317 %attr(755,root,root) %{_bindir}/freshclam
318 %attr(755,root,root) %{_bindir}/sigtool
319 %attr(755,root,root) %{_sbindir}/clamd
320 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
321 %attr(755,clamav,root) %dir /var/lib/%{name}
322 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
323 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
324
325 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
326 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamd.conf
327 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
328
329 %attr(754,root,root) /etc/rc.d/init.d/clamd
330 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
331 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
332 %{_mandir}/man[15]/*
333 %{_mandir}/man8/clamd*
334
335 %if %{with milter}
336 %files milter
337 %defattr(644,root,root,755)
338 %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter
339 %attr(755,root,root) /etc/rc.d/init.d/clamav-milter
340 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
341 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
342 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
343 %attr(755,root,root) %{_sbindir}/clamav-milter
344 %{_mandir}/man8/clamav-milter.8*
345 %attr(700,clamav,clamav) /var/spool/clamav/
346 %endif
347
348 %files libs
349 %defattr(644,root,root,755)
350 %attr(755,root,root) %{_libdir}/lib*.so.*.*
351
352 %files devel
353 %defattr(644,root,root,755)
354 %attr(755,root,root) %{_bindir}/clamav-config
355 %attr(755,root,root) %{_libdir}/lib*.so
356 %{_libdir}/lib*.la
357 %{_includedir}/*.h
358 %{_pkgconfigdir}/*.pc
359
360 %files static
361 %defattr(644,root,root,755)
362 %{_libdir}/*.a
363
364 %files database
365 %defattr(644,root,root,755)
366 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
367 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.067312 seconds and 4 git commands to generate.