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