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