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