]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- addusertogroup with optional group support
[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.2
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.514
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 %addusertogroup -q clamav amavis
198
199 %triggerin -- amavisd-new
200 %addusertogroup -q clamav amavis
201
202 %triggerin -- amavisd
203 %addusertogroup -q clamav amavis
204
205 %pre
206 %groupadd -g 43 clamav
207 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
208 %addusertogroup -q clamav amavis
209
210 %post
211 /sbin/chkconfig --add clamd
212 %service clamd restart "Clam Antivirus daemon"
213 touch /var/log/freshclam.log
214 chown clamav:root /var/log/freshclam.log
215 chmod 640 /var/log/freshclam.log
216
217 %preun
218 if [ "$1" = "0" ]; then
219         %service clamd stop
220         /sbin/chkconfig --del clamd
221 fi
222
223 %postun
224 if [ "$1" = "0" ]; then
225         %userremove clamav
226         %groupremove clamav
227 fi
228
229 %triggerpostun -- %{name} < 0.80
230 if [ -f /etc/clamav.conf.rpmsave ]; then
231         echo "Renaming config to new name /etc/clamd.conf"
232         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
233         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
234         echo "Changing config location in freshclam config"
235         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
236 fi
237
238 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
239 %{__cp} -f /etc/clamd.conf{,.rpmsave}
240 %{__sed} -i -e '
241                 s,^LogSyslog$,& yes,
242                 s,^FixStaleSocket$,& yes,
243                 s,^AllowSupplementaryGroups$,& yes,
244                 s,^ClamukoScanOnOpen$,& yes,
245                 s,^ClamukoScanOnClose$,& yes,
246                 s,^ClamukoScanOnExec$,& yes,
247                 s,^LogTime$,& yes,
248                 s,^ScanPE$,& yes,
249 ' /etc/clamd.conf
250 %banner -e %{name}-0.90 <<EOF
251 ClamAV config was automatically upgraded to 0.90 format. You should review it
252 that it's still valid.
253 EOF
254 #'
255 # unfortunately clamd has no configcheck option so we just have to start it
256 # once again after config was broken after upgrade
257 touch /var/lock/subsys/clamd
258 %service -q clamd restart
259
260 %post milter
261 /sbin/chkconfig --add clamav-milter
262 %service clamav-milter restart "Clam Antivirus daemon"
263
264 %preun milter
265 if [ "$1" = "0" ]; then
266         %service clamav-milter stop
267         /sbin/chkconfig --del clamav-milter
268 fi
269
270 %post   libs -p /sbin/ldconfig
271 %postun libs -p /sbin/ldconfig
272
273 %files
274 %defattr(644,root,root,755)
275 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
276 %attr(755,root,root) %{_bindir}/clamdscan
277 %attr(755,root,root) %{_bindir}/clamdtop
278 %attr(755,root,root) %{_bindir}/clamscan
279 %attr(755,root,root) %{_bindir}/freshclam
280 %attr(755,root,root) %{_bindir}/sigtool
281 %attr(755,root,root) %{_bindir}/clamconf
282 %attr(755,root,root) %{_sbindir}/clamd
283 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
284 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
285 %attr(755,clamav,root) %dir /var/lib/%{name}
286 %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd
287 %attr(640,clamav,root) %ghost /var/log/freshclam.log
288 %attr(750,clamav,clamav) %dir /var/run/%{name}
289
290 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
291 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
292 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
293
294 %attr(754,root,root) /etc/rc.d/init.d/clamd
295 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
296 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
297 %{_mandir}/man[15]/*
298 %{_mandir}/man8/clamd*
299
300 %if %{with milter}
301 %files milter
302 %defattr(644,root,root,755)
303 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
304 %config(noreplace) %verify(not md5 mtime size) /etc/clamav-milter.conf
305 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
306 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
307 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
308 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
309 %attr(755,root,root) %{_sbindir}/clamav-milter
310 %{_mandir}/man8/clamav-milter.8*
311 %attr(700,clamav,clamav) /var/spool/clamav
312 %endif
313
314 %files libs
315 %defattr(644,root,root,755)
316 %attr(755,root,root) %{_libdir}/lib*.so.*.*
317 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
318 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
319 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
320
321 %files devel
322 %defattr(644,root,root,755)
323 %attr(755,root,root) %{_bindir}/clamav-config
324 %attr(755,root,root) %{_libdir}/lib*.so
325 %{_libdir}/lib*.la
326 %{_includedir}/*.h
327 %{_pkgconfigdir}/*.pc
328
329 %files static
330 %defattr(644,root,root,755)
331 %{_libdir}/*.a
This page took 0.050372 seconds and 3 git commands to generate.