]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
0886ca093961b14372674b0cf5220048a9367af1
[packages/clamav.git] / clamav.spec
1 # TODO:
2 #   Make freshclam (script and daemon)
3 #
4 # Conditional build:
5 %bcond_with     milter  # build 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.87.1
12 Release:        1
13 Epoch:          0
14 License:        GPL
15 Group:          Applications
16 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
17 # Source0-md5:  bf9f038edf0b6d5f76552e1b8d014b81
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        20051104
25 Source6:        http://db.local.clamav.net/daily.cvd
26 # Source6-md5:  b76ba65cebc388f102335594524a89f7
27 Source7:        http://db.local.clamav.net/main.cvd
28 # Source7-md5:  e9a5fcea0ad22ca0cbb3beb1ebcdf893
29 Source8:        %{name}-post-updatedb
30 Source9:        %{name}-milter.sysconfig
31 Patch0:         %{name}-pld_config.patch
32 Patch1:         %{name}-no_auto_libwrap.patch
33 Patch2:         %{name}-nolibs.patch
34 URL:            http://www.clamav.net/
35 BuildRequires:  autoconf
36 BuildRequires:  automake
37 %{?with_curl:BuildRequires:     curl-devel}
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):       sed >= 4.0
51 Requires(postun,pre):   /usr/sbin/usermod
52 Requires(post,preun):   /sbin/chkconfig
53 Requires:       /usr/sbin/usermod
54 Requires:       %{name}-libs = %{epoch}:%{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 25000 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 25000 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 = %{epoch}:%{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 = %{epoch}:%{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 +4089 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_curl:--without-libcurl} \
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 "Error: 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 "Error: 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         echo "Removing user clamav"
272         /usr/sbin/userdel clamav
273         echo "Removing group clamav"
274         /usr/sbin/groupdel clamav
275 fi
276
277 %triggerpostun -- %{name} <= 0.75.1
278 if [ -f /etc/clamav.conf.rpmsave ]; then
279         echo "Renaming config to new name /etc/clamd.conf"
280         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
281         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
282         echo "Changing config location in freshclam config"
283         sed -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
284 fi
285
286 %if %{with milter}
287 %post milter
288 /sbin/chkconfig --add clamav-milter
289 if [ -f /var/lock/subsys/clamav-milter ]; then
290         /etc/rc.d/init.d/clamd restart >&2
291 else
292         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
293 fi
294
295 %preun milter
296 if [ "$1" = "0" ]; then
297         if [ -f /var/lock/subsys/clamav-milter ]; then
298                 /etc/rc.d/init.d/clamav-milter stop
299         fi
300         /sbin/chkconfig --del clamav-milter
301 fi
302 %endif
303 %post   libs -p /sbin/ldconfig
304 %postun libs -p /sbin/ldconfig
305
306 %post   database -p %{_sbindir}/%{name}-post-updatedb
307
308 %files
309 %defattr(644,root,root,755)
310 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/*.pdf docs/html/
311 %attr(755,root,root) %{_bindir}/clamdscan
312 %attr(755,root,root) %{_bindir}/clamscan
313 %attr(755,root,root) %{_bindir}/freshclam
314 %attr(755,root,root) %{_bindir}/sigtool
315 %attr(755,root,root) %{_sbindir}/clamd
316 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
317 %attr(755,clamav,root) %dir /var/lib/%{name}
318 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
319 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
320
321 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
322 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamd.conf
323 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
324
325 %attr(754,root,root) /etc/rc.d/init.d/clamd
326 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
327 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
328 %{_mandir}/man[15]/*
329 %{_mandir}/man8/clamd*
330
331 %if %{with milter}
332 %files milter
333 %defattr(644,root,root,755)
334 %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter
335 %attr(755,root,root) /etc/rc.d/init.d/clamav-milter
336 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
337 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
338 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
339 %attr(755,root,root) %{_sbindir}/clamav-milter
340 %{_mandir}/man8/clamav-milter.8*
341 %attr(700,clamav,clamav) /var/spool/clamav/
342 %endif
343
344 %files libs
345 %defattr(644,root,root,755)
346 %attr(755,root,root) %{_libdir}/lib*.so.*.*
347
348 %files devel
349 %defattr(644,root,root,755)
350 %attr(755,root,root) %{_bindir}/clamav-config
351 %attr(755,root,root) %{_libdir}/lib*.so
352 %{_libdir}/lib*.la
353 %{_includedir}/*.h
354 %{_pkgconfigdir}/*.pc
355
356 %files static
357 %defattr(644,root,root,755)
358 %{_libdir}/*.a
359
360 %files database
361 %defattr(644,root,root,755)
362 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
363 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.054278 seconds and 2 git commands to generate.