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