2 # - Make freshclam package (script and daemon)
5 %bcond_without milter # build without milter subpackage
6 %bcond_with curl # enable curl support
8 Summary: An anti-virus utility for Unix
9 Summary(pl.UTF-8): Narzędzie antywirusowe dla Uniksów
16 Source0: http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
17 # Source0-md5: e500651858a9187a87025c8a5c23969c
19 Source2: %{name}.sysconfig
20 Source3: %{name}-milter.init
21 Source4: %{name}-cron-updatedb
22 Source5: %{name}.logrotate
23 Source8: %{name}-post-updatedb
24 Source9: %{name}-milter.sysconfig
25 Patch0: %{name}-pld_config.patch
26 Patch1: %{name}-no_auto_libwrap.patch
27 Patch2: %{name}-nolibs.patch
28 Patch3: %{name}-find_milter.patch
29 Patch4: %{name}-valid_pp_exp.patch
30 URL: http://www.clamav.net/
31 BuildRequires: autoconf
32 BuildRequires: automake
33 BuildRequires: bzip2-devel
34 %{?with_curl:BuildRequires: curl-devel}
35 BuildRequires: gmp-devel
36 %{?with_milter:BuildRequires: libmilter-devel}
37 BuildRequires: libtool
38 %{?with_milter:BuildRequires: libwrap-devel}
39 BuildRequires: rpmbuild(macros) >= 1.268
40 BuildRequires: zlib-devel
41 Requires(post,preun): /sbin/chkconfig
42 Requires(postun): /usr/sbin/groupdel
43 Requires(postun): /usr/sbin/userdel
44 Requires(postun,pre): /usr/sbin/usermod
45 Requires(pre): /bin/id
46 Requires(pre): /usr/bin/getgid
47 Requires(pre): /usr/sbin/groupadd
48 Requires(pre): /usr/sbin/useradd
49 Requires(triggerpostun): sed >= 4.0
50 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
51 Requires: /usr/sbin/usermod
54 Provides: group(clamav)
55 Provides: user(clamav)
56 Conflicts: logrotate < 3.7-4
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
60 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
61 especially for e-mail scanning on mail gateways. It provides a number
62 of utilities including a flexible and scalable multi-threaded daemon,
63 a command line scanner and advanced tool for automatic database
64 updates. The core of the package is an anti-virus engine available in
65 a form of shared library.
67 Here is a list of the main features:
68 - command-line scanner
69 - fast, multi-threaded daemon with support for on-access scanning
70 - milter interface for sendmail
71 - advanced database updater with support for scripted updates and
73 - virus scanner C library
74 - on-access scanning (Linux® and FreeBSD®)
75 - virus database updated multiple times per day (see home page for
76 total number of signatures)
77 - built-in support for various archive formats, including Zip, RAR,
78 Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
79 - built-in support for almost all mail file formats
80 - built-in support for ELF executables and Portable Executable files
81 compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
82 obfuscated with SUE, Y0da Cryptor and others
83 - built-in support for popular document formats including MS Office
84 and MacOffice files, HTML, RTF and PDF
86 %description -l pl.UTF-8
87 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
88 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
89 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
90 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
91 napisany w C i zgodny z POSIXem.
94 Summary: Shared libraries for clamav
95 Summary(pl.UTF-8): Biblioteki dzielone clamav
99 Shared libraries for clamav.
101 %description libs -l pl.UTF-8
102 Biblioteki dzielone clamav.
105 Summary: ClamAV filter using milter interface
106 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
108 Requires: %{name} = %{epoch}:%{version}-%{release}
109 Requires: sendmail >= 8.11
110 Requires: tcp_wrappers
113 ClamAV sendmail filter using MILTER interface.
115 %description milter -l pl.UTF-8
116 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
119 Summary: clamav - Development header files and libraries
120 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
121 Group: Development/Libraries
122 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
123 Requires: bzip2-devel
128 This package contains the development header files and libraries
129 necessary to develop clamav client applications.
131 %description devel -l pl.UTF-8
132 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
136 Summary: clamav static libraries
137 Summary(pl.UTF-8): Biblioteki statyczne clamav
138 Group: Development/Libraries
139 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
142 clamav static libraries.
144 %description static -l pl.UTF-8
145 Biblioteki statyczne clamav.
148 %setup -q %{?_rc:-n %{name}-%{version}%{_rc}}
163 %{!?with_curl:--without-libcurl} \
164 %{?with_milter:--enable-milter} \
165 --with-dbdir=/var/lib/%{name}
169 rm -rf $RPM_BUILD_ROOT
170 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
171 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav}
174 DESTDIR=$RPM_BUILD_ROOT
175 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
177 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
178 5 * * * * root %{_sbindir}/clamav-cron-updatedb
181 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
183 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
184 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
186 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
187 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
188 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
189 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
191 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
193 # NOTE: clamd uses sane rights to it's clamd.pid file
194 # So better keep it dir
195 # If it is fixed use of dir will be unecesary
196 install -d $RPM_BUILD_ROOT/var/run/%{name}
198 :> $RPM_BUILD_ROOT/var/log/freshclam.log
201 rm -rf $RPM_BUILD_ROOT
203 %triggerin -- amavis-ng
204 AMAVIS=$(/usr/bin/getgid amavis)
206 if [ $RESULT -eq 0 ]; then
207 echo "Adding clamav to amavis group GID=$AMAVIS"
208 /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
211 %triggerin -- amavisd-new
212 AMAVIS=$(/usr/bin/getgid amavis)
214 if [ $RESULT -eq 0 ]; then
215 echo "Adding clamav to amavis group GID=$AMAVIS"
216 /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
219 %triggerin -- amavisd
220 AMAVIS=$(/usr/bin/getgid amavis)
222 if [ $RESULT -eq 0 ]; then
223 echo "Adding clamav to amavis group GID=$AMAVIS"
224 /usr/sbin/usermod -G amavis clamav 1>&2
228 %groupadd -g 43 clamav
229 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
231 # FIXME: check this. is it proper after useradd macro?
232 # TODO: use addusertogroup macro?
233 if [ -n "`/usr/bin/getgid amavis`" ]; then
234 echo "Adding clamav to amavis group"
235 /usr/sbin/usermod -G amavis clamav 1>&2
239 /sbin/chkconfig --add clamd
240 %service clamd restart "Clam Antivirus daemon"
241 touch /var/log/freshclam.log
242 chown clamav:root /var/log/freshclam.log
243 chmod 640 /var/log/freshclam.log
246 if [ "$1" = "0" ]; then
248 /sbin/chkconfig --del clamd
252 if [ "$1" = "0" ]; then
257 %triggerpostun -- %{name} < 0.80
258 if [ -f /etc/clamav.conf.rpmsave ]; then
259 echo "Renaming config to new name /etc/clamd.conf"
260 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
261 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
262 echo "Changing config location in freshclam config"
263 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
266 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
267 %{__cp} -f /etc/clamd.conf{,.rpmsave}
270 s,^FixStaleSocket$,& yes,
271 s,^AllowSupplementaryGroups$,& yes,
272 s,^ClamukoScanOnOpen$,& yes,
273 s,^ClamukoScanOnClose$,& yes,
274 s,^ClamukoScanOnExec$,& yes,
278 %banner -e %{name}-0.90 <<EOF
279 ClamAV config was automatically upgraded to 0.90 format. You should review it
280 that it's still valid.
283 # unfortunately clamd has no configcheck option so we just have to start it
284 # once again after config was broken after upgrade
285 touch /var/lock/subsys/clamd
286 %service -q clamd restart
289 /sbin/chkconfig --add clamav-milter
290 %service clamav-milter restart "Clam Antivirus daemon"
293 if [ "$1" = "0" ]; then
294 %service clamav-milter stop
295 /sbin/chkconfig --del clamav-milter
298 %post libs -p /sbin/ldconfig
299 %postun libs -p /sbin/ldconfig
302 %defattr(644,root,root,755)
303 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
304 %attr(755,root,root) %{_bindir}/clamdscan
305 %attr(755,root,root) %{_bindir}/clamscan
306 %attr(755,root,root) %{_bindir}/freshclam
307 %attr(755,root,root) %{_bindir}/sigtool
308 %attr(755,root,root) %{_bindir}/clamconf
309 %attr(755,root,root) %{_sbindir}/clamd
310 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
311 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
312 %attr(755,clamav,root) %dir /var/lib/%{name}
313 %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd
314 %attr(640,clamav,root) %ghost /var/log/freshclam.log
315 %attr(750,clamav,clamav) %dir /var/run/%{name}
317 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
318 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
319 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
321 %attr(754,root,root) /etc/rc.d/init.d/clamd
322 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
323 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
325 %{_mandir}/man8/clamd*
329 %defattr(644,root,root,755)
330 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
331 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
332 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
333 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
334 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
335 %attr(755,root,root) %{_sbindir}/clamav-milter
336 %{_mandir}/man8/clamav-milter.8*
337 %attr(700,clamav,clamav) /var/spool/clamav
341 %defattr(644,root,root,755)
342 %attr(755,root,root) %{_libdir}/lib*.so.*.*
345 %defattr(644,root,root,755)
346 %attr(755,root,root) %{_bindir}/clamav-config
347 %attr(755,root,root) %{_libdir}/lib*.so
350 %{_pkgconfigdir}/*.pc
353 %defattr(644,root,root,755)