]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- config 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.7
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.7
279 if [ -f /etc/clamav.conf.rpmnew ]; then
280         %{__cp} -f /etc/clamd.conf{,.rpmsave}
281         %{__sed} -i -e '
282                         s,^LogSyslog$,& yes,
283                         s,^FixStaleSocket$,& yes,
284                         s,^AllowSupplementaryGroups$,& yes,
285                         s,^ClamukoScanOnOpen$,& yes,
286                         s,^ClamukoScanOnClose$,& yes,
287                         s,^ClamukoScanOnExec$,& yes,
288         ' /etc/clamd.conf
289 fi
290
291 %post milter
292 /sbin/chkconfig --add clamav-milter
293 %service clamav-milter restart "Clam Antivirus daemon"
294
295 %preun milter
296 if [ "$1" = "0" ]; then
297         %service clamav-milter stop
298         /sbin/chkconfig --del clamav-milter
299 fi
300
301 %post   libs -p /sbin/ldconfig
302 %postun libs -p /sbin/ldconfig
303
304 %post   database -p %{_sbindir}/%{name}-post-updatedb
305
306 %files
307 %defattr(644,root,root,755)
308 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/*.pdf
309 %attr(755,root,root) %{_bindir}/clamdscan
310 %attr(755,root,root) %{_bindir}/clamscan
311 %attr(755,root,root) %{_bindir}/freshclam
312 %attr(755,root,root) %{_bindir}/sigtool
313 %attr(755,root,root) %{_bindir}/clamconf
314 %attr(755,root,root) %{_sbindir}/clamd
315 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
316 %attr(755,clamav,root) %dir /var/lib/%{name}
317 %attr(640,clamav,root) %ghost /var/log/freshclam.log
318 %attr(750,clamav,clamav) %dir /var/run/%{name}
319
320 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
321 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
322 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
323
324 %attr(754,root,root) /etc/rc.d/init.d/clamd
325 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
326 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
327 %{_mandir}/man[15]/*
328 %{_mandir}/man8/clamd*
329
330 %if %{with milter}
331 %files milter
332 %defattr(644,root,root,755)
333 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
334 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
335 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
336 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
337 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
338 %attr(755,root,root) %{_sbindir}/clamav-milter
339 %{_mandir}/man8/clamav-milter.8*
340 %attr(700,clamav,clamav) /var/spool/clamav
341 %endif
342
343 %files libs
344 %defattr(644,root,root,755)
345 %attr(755,root,root) %{_libdir}/lib*.so.*.*
346
347 %files devel
348 %defattr(644,root,root,755)
349 %attr(755,root,root) %{_bindir}/clamav-config
350 %attr(755,root,root) %{_libdir}/lib*.so
351 %{_libdir}/lib*.la
352 %{_includedir}/*.h
353 %{_pkgconfigdir}/*.pc
354
355 %files static
356 %defattr(644,root,root,755)
357 %{_libdir}/*.a
358
359 %if %{with database}
360 %files database
361 %defattr(644,root,root,755)
362 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
363 %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/%{name}/*.cvd
364 %endif # database
This page took 0.049514 seconds and 4 git commands to generate.