]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- update for 0.91
[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 %bcond_with     curl            # enable curl support
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.91
12 Release:        1
13 Epoch:          0
14 License:        GPL
15 Group:          Applications
16 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
17 # Source0-md5:  35192423e44642c86ea69dc93f59cfb1
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}-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
52 Requires:       bc
53 Requires:       rc-scripts
54 Provides:       group(clamav)
55 Provides:       user(clamav)
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %description
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.
64
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.
71
72 %package libs
73 Summary:        Shared libraries for clamav
74 Summary(pl.UTF-8):      Biblioteki dzielone clamav
75 Group:          Libraries
76
77 %description libs
78 Shared libraries for clamav.
79
80 %description libs -l pl.UTF-8
81 Biblioteki dzielone clamav.
82
83 %package milter
84 Summary:        ClamAV filter using milter interface
85 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
86 Group:          Daemons
87 Requires:       %{name} = %{epoch}:%{version}-%{release}
88 Requires:       sendmail >= 8.11
89 Requires:       tcp_wrappers
90
91 %description milter
92 ClamAV sendmail filter using MILTER interface.
93
94 %description milter -l pl.UTF-8
95 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
96
97 %package devel
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
103 Requires:       gmp-devel
104 Requires:       zlib-devel
105
106 %description devel
107 This package contains the development header files and libraries
108 necessary to develop clamav client applications.
109
110 %description devel -l pl.UTF-8
111 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
112 klienckich clamav.
113
114 %package static
115 Summary:        clamav static libraries
116 Summary(pl.UTF-8):      Biblioteki statyczne clamav
117 Group:          Development/Libraries
118 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
119
120 %description static
121 clamav static libraries.
122
123 %description static -l pl.UTF-8
124 Biblioteki statyczne clamav.
125
126 %prep
127 %setup -q %{?_rc:-n %{name}-%{version}%{_rc}}
128 %patch0 -p1
129 %patch1 -p1
130 %patch2 -p1
131 %patch3 -p1
132 %patch4 -p0
133
134 %build
135 %{__libtoolize}
136 %{__aclocal}
137 %{__autoconf}
138 %{__autoheader}
139 %{__automake}
140 %configure \
141         --disable-clamav \
142         %{!?with_curl:--without-libcurl} \
143         %{?with_milter:--enable-milter} \
144         --with-dbdir=/var/lib/%{name}
145 %{__make}
146
147 %install
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}
151
152 %{__make} install \
153         DESTDIR=$RPM_BUILD_ROOT
154 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
155
156 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
157 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
158 EOF
159
160 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
161 %if %{with milter}
162 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
163 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
164 %endif
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}
169
170 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
171
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}
176
177 :> $RPM_BUILD_ROOT/var/log/freshclam.log
178
179 %clean
180 rm -rf $RPM_BUILD_ROOT
181
182 %triggerin -- amavis-ng
183 AMAVIS=$(/usr/bin/getgid amavis)
184 RESULT=$?
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
188 fi
189
190 %triggerin -- amavisd-new
191 AMAVIS=$(/usr/bin/getgid amavis)
192 RESULT=$?
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
196 fi
197
198 %triggerin -- amavisd
199 AMAVIS=$(/usr/bin/getgid amavis)
200 RESULT=$?
201 if [ $RESULT -eq 0 ]; then
202         echo "Adding clamav to amavis group GID=$AMAVIS"
203         /usr/sbin/usermod -G amavis clamav 1>&2
204 fi
205
206 %pre
207 %groupadd -g 43 clamav
208 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
209
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
215 fi
216
217 %post
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
223
224 %preun
225 if [ "$1" = "0" ]; then
226         %service clamd stop
227         /sbin/chkconfig --del clamd
228 fi
229
230 %postun
231 if [ "$1" = "0" ]; then
232         %userremove clamav
233         %groupremove clamav
234 fi
235
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
243 fi
244
245 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
246 %{__cp} -f /etc/clamd.conf{,.rpmsave}
247 %{__sed} -i -e '
248                 s,^LogSyslog$,& yes,
249                 s,^FixStaleSocket$,& yes,
250                 s,^AllowSupplementaryGroups$,& yes,
251                 s,^ClamukoScanOnOpen$,& yes,
252                 s,^ClamukoScanOnClose$,& yes,
253                 s,^ClamukoScanOnExec$,& yes,
254                 s,^LogTime$,& yes,
255                 s,^ScanPE$,& yes,
256 ' /etc/clamd.conf
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.
260 EOF
261 #'
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
266
267 %post milter
268 /sbin/chkconfig --add clamav-milter
269 %service clamav-milter restart "Clam Antivirus daemon"
270
271 %preun milter
272 if [ "$1" = "0" ]; then
273         %service clamav-milter stop
274         /sbin/chkconfig --del clamav-milter
275 fi
276
277 %post   libs -p /sbin/ldconfig
278 %postun libs -p /sbin/ldconfig
279
280 %files
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}
295
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
299
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
303 %{_mandir}/man[15]/*
304 %{_mandir}/man8/clamd*
305
306 %if %{with milter}
307 %files milter
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
317 %endif
318
319 %files libs
320 %defattr(644,root,root,755)
321 %attr(755,root,root) %{_libdir}/lib*.so.*.*
322
323 %files devel
324 %defattr(644,root,root,755)
325 %attr(755,root,root) %{_bindir}/clamav-config
326 %attr(755,root,root) %{_libdir}/lib*.so
327 %{_libdir}/lib*.la
328 %{_includedir}/*.h
329 %{_pkgconfigdir}/*.pc
330
331 %files static
332 %defattr(644,root,root,755)
333 %{_libdir}/*.a
This page took 0.106953 seconds and 4 git commands to generate.