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