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