2 # - Make freshclam (script and daemon)
3 # - check how the "scripted updates" work (instead of old full cvd download)
6 %bcond_without milter # build without milter subpackage
7 %bcond_without database # build without databases subpackage
8 %bcond_with curl # enable curl support
13 Summary: An anti-virus utility for Unix
14 Summary(pl): Narzêdzie antywirusowe dla Uniksów
17 Release: 0.%{_rc}.%{_rel}
21 Source0: http://dl.sourceforge.net/clamav/%{name}-%{version}%{_rc}.tar.gz
22 # Source0-md5: 91da47456ed28a7cfbfe17b033e15121
24 Source2: %{name}.sysconfig
25 Source3: %{name}-milter.init
26 Source4: %{name}-cron-updatedb
27 Source5: %{name}.logrotate
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
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
65 Provides: group(clamav)
66 Provides: user(clamav)
67 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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.
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.
84 Summary: Shared libraries for clamav
85 Summary(pl): Biblioteki dzielone clamav
89 Shared libraries for clamav.
91 %description libs -l pl
92 Biblioteki dzielone clamav.
95 Summary: ClamAV filter using milter interface
96 Summary(pl): Filtr ClamAV korzystaj±cy z interfejsu milter
98 Requires: %{name} = %{epoch}:%{version}-%{release}
99 Requires: sendmail >= 8.11
100 Requires: tcp_wrappers
103 ClamAV sendmail filter using MILTER interface.
105 %description milter -l pl
106 Filtr ClamAV dla sendmaila korzystaj±cy z interfejsu MILTER.
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
118 This package contains the development header files and libraries
119 necessary to develop clamav client applications.
121 %description devel -l pl
122 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
126 Summary: clamav static libraries
127 Summary(pl): Biblioteki statyczne clamav
128 Group: Development/Libraries
129 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
132 clamav static libraries.
134 %description static -l pl
135 Biblioteki statyczne clamav.
138 Summary: Virus database for clamav
139 Summary(pl): Bazy wirusów dla clamav
140 Version: %{_ver}.%{database_version}
141 Group: Applications/Databases
144 %description database
145 Virus database for clamav (updated %{database_version}).
147 %description database -l pl
148 Bazy wirusów dla clamav (aktualizowana %{database_version}).
151 %setup -q %{?_rc:-n %{name}-%{_ver}%{_rc}}
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
169 %{!?with_curl:--without-libcurl} \
170 %{?with_milter:--enable-milter} \
171 --with-dbdir=/var/lib/%{name}
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}
180 DESTDIR=$RPM_BUILD_ROOT
181 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
183 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
184 5 * * * * root %{_sbindir}/clamav-cron-updatedb
187 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
189 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
190 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
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}
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}
202 rm -f $RPM_BUILD_ROOT/var/lib/%{name}/{main,daily}.cvd
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}
210 :> $RPM_BUILD_ROOT/var/log/freshclam.log
213 rm -rf $RPM_BUILD_ROOT
215 %triggerin -- amavis-ng
216 AMAVIS=$(/usr/bin/getgid amavis)
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
223 %triggerin -- amavisd-new
224 AMAVIS=$(/usr/bin/getgid amavis)
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
231 %triggerin -- amavisd
232 AMAVIS=$(/usr/bin/getgid amavis)
234 if [ $RESULT -eq 0 ]; then
235 echo "Adding clamav to amavis group GID=$AMAVIS"
236 /usr/sbin/usermod -G amavis clamav 1>&2
240 %groupadd -g 43 clamav
241 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
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
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
258 if [ "$1" = "0" ]; then
260 /sbin/chkconfig --del clamd
264 if [ "$1" = "0" ]; then
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
278 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
279 %{__cp} -f /etc/clamd.conf{,.rpmsave}
282 s,^FixStaleSocket$,& yes,
283 s,^AllowSupplementaryGroups$,& yes,
284 s,^ClamukoScanOnOpen$,& yes,
285 s,^ClamukoScanOnClose$,& yes,
286 s,^ClamukoScanOnExec$,& yes,
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.
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
299 /sbin/chkconfig --add clamav-milter
300 %service clamav-milter restart "Clam Antivirus daemon"
303 if [ "$1" = "0" ]; then
304 %service clamav-milter stop
305 /sbin/chkconfig --del clamav-milter
308 %post libs -p /sbin/ldconfig
309 %postun libs -p /sbin/ldconfig
311 %post database -p %{_sbindir}/%{name}-post-updatedb
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}
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
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
335 %{_mandir}/man8/clamd*
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
351 %defattr(644,root,root,755)
352 %attr(755,root,root) %{_libdir}/lib*.so.*.*
355 %defattr(644,root,root,755)
356 %attr(755,root,root) %{_bindir}/clamav-config
357 %attr(755,root,root) %{_libdir}/lib*.so
360 %{_pkgconfigdir}/*.pc
363 %defattr(644,root,root,755)
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