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