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