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