]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- added bcond for curl, disabled by default as previous versions were
[packages/clamav.git] / clamav.spec
1 # TODO:
2 #   Make freshclam (script and daemon)
3 #
4 # Conditional build:
5 %bcond_with     milter  # without milter subpackage
6 %bcond_with     curl    # without curl
7 #
8 Summary:        An anti-virus utility for Unix
9 Summary(pl):    Antywirusowe narzêdzie dla Uniksów
10 Name:           clamav
11 Version:        0.80rc4
12 Release:        1
13 License:        GPL
14 Group:          Applications
15 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
16 # Source0-md5:  5c02d52c361f04098a9956478f8654a0
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        20041016
25 Source6:        http://db.local.clamav.net/daily.cvd
26 # Source6-md5:  0407cabd808a894c5fdc6b4e79dff265
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 URL:            http://www.clamav.net/
37 BuildRequires:  autoconf
38 BuildRequires:  automake
39 %{?with_curl:BuildRequires:     curl-devel}
40 BuildRequires:  gmp-devel
41 %{?with_curl:BuildRequires:     libidn-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,pre):   /usr/sbin/usermod
54 Requires(post,preun):   /sbin/chkconfig
55 Requires:       /usr/sbin/usermod
56 Requires:       %{name}-libs = %{version}-%{release}
57 Requires:       bc
58 %{?with_curl:Requires:  curl}
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 = %{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 = %{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
150 # kill old libtool.m4 copy
151 head -n 489 acinclude.m4 > acinclude.m4.tmp
152 tail -n +4064 acinclude.m4 >> acinclude.m4.tmp
153 mv -f acinclude.m4.tmp acinclude.m4
154
155 %build
156 %{__libtoolize}
157 %{__aclocal}
158 %{__autoconf}
159 %{__autoheader}
160 %{__automake}
161 %configure \
162         --disable-clamav \
163         %{?!with_curl:--without-libcurl} \
164         %{?with_milter:--enable-milter} \
165         --with-dbdir=/var/lib/%{name}
166 %{__make}
167
168 %install
169 rm -rf $RPM_BUILD_ROOT
170 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
171         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/{log,spool/clamav}}
172
173 %{__make} install \
174         DESTDIR=$RPM_BUILD_ROOT
175 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
176
177 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
178 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
179 EOF
180
181 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
182 %if %{with milter}
183 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
184 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
185 %endif
186 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
187 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
188 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
189 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
190 install %{SOURCE6} $RPM_BUILD_ROOT/var/lib/%{name}
191 install %{SOURCE7} $RPM_BUILD_ROOT/var/lib/%{name}
192 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
193
194 # NOTE: clamd uses sane rights to it's clamd.pid file
195 # So better keep it dir
196 # If it is fixed use of dir will be unecesary
197 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
198
199 touch $RPM_BUILD_ROOT%{_var}/log/freshclam.log
200
201 %clean
202 rm -rf $RPM_BUILD_ROOT
203
204 %triggerin -- amavis-ng
205 AMAVIS=$(/usr/bin/getgid amavis)
206 RESULT=$?
207 if [ $RESULT -eq 0 ]; then
208         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
209         echo "adding clamav to amavis group GID=$AMAVIS"
210 fi
211
212 %triggerin -- amavisd-new
213 AMAVIS=$(/usr/bin/getgid amavis)
214 RESULT=$?
215 if [ $RESULT -eq 0 ]; then
216         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
217         echo "adding clamav to amavis group GID=$AMAVIS"
218 fi
219
220 %triggerin -- amavisd
221 AMAVIS=$(/usr/bin/getgid amavis)
222 RESULT=$?
223 if [ $RESULT -eq 0 ]; then
224         echo "adding clamav to amavis group GID=$AMAVIS"
225         /usr/sbin/usermod -G amavis clamav 1>&2
226 fi
227
228 %pre
229 if [ -n "`/usr/bin/getgid clamav`" ]; then
230         if [ "`/usr/bin/getgid clamav`" != 43 ]; then
231                 echo "Warning: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
232                 exit 1
233         fi
234 else
235         echo "Adding group clamav GID=43"
236         /usr/sbin/groupadd -g 43 clamav
237 fi
238 if [ -n "`/bin/id -u clamav 2>/dev/null`" ]; then
239         if [ "`/bin/id -u clamav`" != 43 ]; then
240                 echo "Warning: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
241                 exit 1
242         fi
243 else
244         echo "Adding user clamav UID=43"
245         /usr/sbin/useradd -u 43 -d /tmp -s /bin/false \
246                 -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
247         if [ -n "`/usr/bin/getgid amavis`" ]; then
248                 echo "adding clamav to amavis group"
249                 /usr/sbin/usermod -G amavis clamav 1>&2
250         fi
251 fi
252
253 %post
254 /sbin/chkconfig --add clamd
255 if [ -f /var/lock/subsys/clamd ]; then
256         /etc/rc.d/init.d/clamd restart >&2
257 else
258         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
259 fi
260 touch %{_var}/log/freshclam.log
261 chown clamav:root %{_var}/log/freshclam.log
262 chmod 640 %{_var}/log/freshclam.log
263
264 %preun
265 if [ "$1" = "0" ]; then
266         if [ -f /var/lock/subsys/clamd ]; then
267                 /etc/rc.d/init.d/clamd stop
268         fi
269         /sbin/chkconfig --del clamd
270 fi
271
272 %postun
273 if [ "$1" = "0" ]; then
274         %userremove clamav
275         %groupremove clamav
276 fi
277
278 %if %{with milter}
279 %post milter
280 /sbin/chkconfig --add clamav-milter
281 if [ -f /var/lock/subsys/clamav-milter ]; then
282         /etc/rc.d/init.d/clamd restart >&2
283 else
284         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
285 fi
286
287 %preun milter
288 if [ "$1" = "0" ]; then
289         if [ -f /var/lock/subsys/clamav-milter ]; then
290                 /etc/rc.d/init.d/clamav-milter stop
291         fi
292         /sbin/chkconfig --del clamav-milter
293 fi
294 %endif
295 %post   libs -p /sbin/ldconfig
296 %postun libs -p /sbin/ldconfig
297
298 %post   database -p %{_sbindir}/%{name}-post-updatedb
299
300 %files
301 %defattr(644,root,root,755)
302 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
303 %attr(755,root,root) %{_bindir}/clamdscan
304 %attr(755,root,root) %{_bindir}/clamscan
305 %attr(755,root,root) %{_bindir}/freshclam
306 %attr(755,root,root) %{_bindir}/sigtool
307 %attr(755,root,root) %{_sbindir}/clamd
308 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
309 %attr(755,clamav,root) %dir /var/lib/%{name}
310 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
311 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
312
313 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
314 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamd.conf
315 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
316
317 %attr(754,root,root) /etc/rc.d/init.d/clamd
318 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
319 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
320 %{_mandir}/man[15]/*
321 %{_mandir}/man8/clamd*
322
323 %if %{with milter}
324 %files milter
325 %defattr(644,root,root,755)
326 %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter
327 %attr(755,root,root) /etc/rc.d/init.d/clamav-milter
328 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
329 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
330 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
331 %attr(755,root,root) %{_sbindir}/clamav-milter
332 %{_mandir}/man8/clamav-milter.8*
333 %attr(700,clamav,clamav) /var/spool/clamav/
334 %endif
335
336 %files libs
337 %defattr(644,root,root,755)
338 %attr(755,root,root) %{_libdir}/lib*.so.*.*
339
340 %files devel
341 %defattr(644,root,root,755)
342 %attr(755,root,root) %{_bindir}/clamav-config
343 %attr(755,root,root) %{_libdir}/lib*.so
344 %{_libdir}/lib*.la
345 %{_includedir}/*.h
346 %{_pkgconfigdir}/*.pc
347
348 %files static
349 %defattr(644,root,root,755)
350 %{_libdir}/*.a
351
352 %files database
353 %defattr(644,root,root,755)
354 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
355 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.055579 seconds and 3 git commands to generate.