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: 35192423e44642c86ea69dc93f59cfb1
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 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
60 AMaViS, compressed files, on-access scanning and includes a program
61 for auto-updating with support for digital signatures. The virus
62 database has over 90000 viruses, worms and trojans signatures. The
63 scanner is multithreaded, written in C, and POSIX compliant.
65 %description -l pl.UTF-8
66 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
67 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
68 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
69 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
70 napisany w C i zgodny z POSIXem.
73 Summary: Shared libraries for clamav
74 Summary(pl.UTF-8): Biblioteki dzielone clamav
78 Shared libraries for clamav.
80 %description libs -l pl.UTF-8
81 Biblioteki dzielone clamav.
84 Summary: ClamAV filter using milter interface
85 Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter
87 Requires: %{name} = %{epoch}:%{version}-%{release}
88 Requires: sendmail >= 8.11
89 Requires: tcp_wrappers
92 ClamAV sendmail filter using MILTER interface.
94 %description milter -l pl.UTF-8
95 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
98 Summary: clamav - Development header files and libraries
99 Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów
100 Group: Development/Libraries
101 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
102 Requires: bzip2-devel
107 This package contains the development header files and libraries
108 necessary to develop clamav client applications.
110 %description devel -l pl.UTF-8
111 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
115 Summary: clamav static libraries
116 Summary(pl.UTF-8): Biblioteki statyczne clamav
117 Group: Development/Libraries
118 Requires: %{name}-devel = %{epoch}:%{version}-%{release}
121 clamav static libraries.
123 %description static -l pl.UTF-8
124 Biblioteki statyczne clamav.
127 %setup -q %{?_rc:-n %{name}-%{version}%{_rc}}
142 %{!?with_curl:--without-libcurl} \
143 %{?with_milter:--enable-milter} \
144 --with-dbdir=/var/lib/%{name}
148 rm -rf $RPM_BUILD_ROOT
149 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
150 $RPM_BUILD_ROOT%{_var}/{log,spool/clamav}
153 DESTDIR=$RPM_BUILD_ROOT
154 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
156 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
157 5 * * * * root %{_sbindir}/clamav-cron-updatedb
160 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
162 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
163 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
165 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
166 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
167 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
168 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
170 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
172 # NOTE: clamd uses sane rights to it's clamd.pid file
173 # So better keep it dir
174 # If it is fixed use of dir will be unecesary
175 install -d $RPM_BUILD_ROOT/var/run/%{name}
177 :> $RPM_BUILD_ROOT/var/log/freshclam.log
180 rm -rf $RPM_BUILD_ROOT
182 %triggerin -- amavis-ng
183 AMAVIS=$(/usr/bin/getgid amavis)
185 if [ $RESULT -eq 0 ]; then
186 echo "Adding clamav to amavis group GID=$AMAVIS"
187 /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
190 %triggerin -- amavisd-new
191 AMAVIS=$(/usr/bin/getgid amavis)
193 if [ $RESULT -eq 0 ]; then
194 echo "Adding clamav to amavis group GID=$AMAVIS"
195 /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
198 %triggerin -- amavisd
199 AMAVIS=$(/usr/bin/getgid amavis)
201 if [ $RESULT -eq 0 ]; then
202 echo "Adding clamav to amavis group GID=$AMAVIS"
203 /usr/sbin/usermod -G amavis clamav 1>&2
207 %groupadd -g 43 clamav
208 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
210 # FIXME: check this. is it proper after useradd macro?
211 # TODO: use addusertogroup macro?
212 if [ -n "`/usr/bin/getgid amavis`" ]; then
213 echo "Adding clamav to amavis group"
214 /usr/sbin/usermod -G amavis clamav 1>&2
218 /sbin/chkconfig --add clamd
219 %service clamd restart "Clam Antivirus daemon"
220 touch /var/log/freshclam.log
221 chown clamav:root /var/log/freshclam.log
222 chmod 640 /var/log/freshclam.log
225 if [ "$1" = "0" ]; then
227 /sbin/chkconfig --del clamd
231 if [ "$1" = "0" ]; then
236 %triggerpostun -- %{name} <= 0.75.1
237 if [ -f /etc/clamav.conf.rpmsave ]; then
238 echo "Renaming config to new name /etc/clamd.conf"
239 mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
240 mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
241 echo "Changing config location in freshclam config"
242 %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
245 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
246 %{__cp} -f /etc/clamd.conf{,.rpmsave}
249 s,^FixStaleSocket$,& yes,
250 s,^AllowSupplementaryGroups$,& yes,
251 s,^ClamukoScanOnOpen$,& yes,
252 s,^ClamukoScanOnClose$,& yes,
253 s,^ClamukoScanOnExec$,& yes,
257 %banner -e %{name}-0.90 <<EOF
258 ClamAV config was automatically upgraded to 0.90 format. You should review it
259 that it's still valid.
262 # unfortunately clamd has no configcheck option so we just have to start it
263 # once again after config was broken after upgrade
264 touch /var/lock/subsys/clamd
265 %service -q clamd restart
268 /sbin/chkconfig --add clamav-milter
269 %service clamav-milter restart "Clam Antivirus daemon"
272 if [ "$1" = "0" ]; then
273 %service clamav-milter stop
274 /sbin/chkconfig --del clamav-milter
277 %post libs -p /sbin/ldconfig
278 %postun libs -p /sbin/ldconfig
281 %defattr(644,root,root,755)
282 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
283 %attr(755,root,root) %{_bindir}/clamdscan
284 %attr(755,root,root) %{_bindir}/clamscan
285 %attr(755,root,root) %{_bindir}/freshclam
286 %attr(755,root,root) %{_bindir}/sigtool
287 %attr(755,root,root) %{_bindir}/clamconf
288 %attr(755,root,root) %{_sbindir}/clamd
289 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
290 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
291 %attr(755,clamav,root) %dir /var/lib/%{name}
292 %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd
293 %attr(640,clamav,root) %ghost /var/log/freshclam.log
294 %attr(750,clamav,clamav) %dir /var/run/%{name}
296 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
297 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
298 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
300 %attr(754,root,root) /etc/rc.d/init.d/clamd
301 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
302 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
304 %{_mandir}/man8/clamd*
308 %defattr(644,root,root,755)
309 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
310 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
311 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
312 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
313 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
314 %attr(755,root,root) %{_sbindir}/clamav-milter
315 %{_mandir}/man8/clamav-milter.8*
316 %attr(700,clamav,clamav) /var/spool/clamav
320 %defattr(644,root,root,755)
321 %attr(755,root,root) %{_libdir}/lib*.so.*.*
324 %defattr(644,root,root,755)
325 %attr(755,root,root) %{_bindir}/clamav-config
326 %attr(755,root,root) %{_libdir}/lib*.so
329 %{_pkgconfigdir}/*.pc
332 %defattr(644,root,root,755)