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