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