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