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