]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- _rel 1
[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 %define         _rc             rc2
9 %define         _rel    1
10 Summary:        An anti-virus utility for Unix
11 Summary(pl):    Narzêdzie antywirusowe dla Uniksów
12 Name:           clamav
13 Version:        0.90
14 Release:        0.%{_rc}.%{_rel}
15 Epoch:          0
16 License:        GPL
17 Group:          Applications
18 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}%{_rc}.tar.gz
19 # Source0-md5:  91da47456ed28a7cfbfe17b033e15121
20 Source1:        %{name}.init
21 Source2:        %{name}.sysconfig
22 Source3:        %{name}-milter.init
23 Source4:        %{name}-cron-updatedb
24 Source5:        %{name}.logrotate
25 Source8:        %{name}-post-updatedb
26 Source9:        %{name}-milter.sysconfig
27 Patch0:         %{name}-pld_config.patch
28 Patch1:         %{name}-no_auto_libwrap.patch
29 Patch2:         %{name}-nolibs.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 BuildRequires:  libtool
37 %{?with_milter:BuildRequires:   libwrap-devel}
38 BuildRequires:  rpmbuild(macros) >= 1.268
39 %{?with_milter:BuildRequires:   sendmail-devel >= 8.11}
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 85387 viruses, worms and trojans signatures. The
63 scanner is multithreaded, written in C, and POSIX compliant.
64
65 %description -l pl
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 85387 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):    Biblioteki dzielone clamav
75 Group:          Libraries
76
77 %description libs
78 Shared libraries for clamav.
79
80 %description libs -l pl
81 Biblioteki dzielone clamav.
82
83 %package milter
84 Summary:        ClamAV filter using milter interface
85 Summary(pl):    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
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):    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
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):    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
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
132 # kill old libtool.m4 copy
133 head -n 489 acinclude.m4 > acinclude.m4.tmp
134 tail -n +4089 acinclude.m4 >> acinclude.m4.tmp
135 mv -f acinclude.m4.tmp acinclude.m4
136
137 %build
138 %{__libtoolize}
139 %{__aclocal}
140 %{__autoconf}
141 %{__autoheader}
142 %{__automake}
143 %configure \
144         --disable-clamav \
145         %{!?with_curl:--without-libcurl} \
146         %{?with_milter:--enable-milter} \
147         --with-dbdir=/var/lib/%{name}
148 %{__make}
149
150 %install
151 rm -rf $RPM_BUILD_ROOT
152 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
153         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav}
154
155 %{__make} install \
156         DESTDIR=$RPM_BUILD_ROOT
157 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
158
159 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
160 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
161 EOF
162
163 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
164 %if %{with milter}
165 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
166 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
167 %endif
168 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
169 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
170 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
171 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
172
173 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
174
175 # NOTE: clamd uses sane rights to it's clamd.pid file
176 # So better keep it dir
177 # If it is fixed use of dir will be unecesary
178 install -d $RPM_BUILD_ROOT/var/run/%{name}
179
180 :> $RPM_BUILD_ROOT/var/log/freshclam.log
181
182 %clean
183 rm -rf $RPM_BUILD_ROOT
184
185 %triggerin -- amavis-ng
186 AMAVIS=$(/usr/bin/getgid amavis)
187 RESULT=$?
188 if [ $RESULT -eq 0 ]; then
189         echo "Adding clamav to amavis group GID=$AMAVIS"
190         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
191 fi
192
193 %triggerin -- amavisd-new
194 AMAVIS=$(/usr/bin/getgid amavis)
195 RESULT=$?
196 if [ $RESULT -eq 0 ]; then
197         echo "Adding clamav to amavis group GID=$AMAVIS"
198         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
199 fi
200
201 %triggerin -- amavisd
202 AMAVIS=$(/usr/bin/getgid amavis)
203 RESULT=$?
204 if [ $RESULT -eq 0 ]; then
205         echo "Adding clamav to amavis group GID=$AMAVIS"
206         /usr/sbin/usermod -G amavis clamav 1>&2
207 fi
208
209 %pre
210 %groupadd -g 43 clamav
211 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
212
213 # FIXME: check this. is it proper after useradd macro?
214 # TODO: use addusertogroup macro?
215 if [ -n "`/usr/bin/getgid amavis`" ]; then
216         echo "Adding clamav to amavis group"
217         /usr/sbin/usermod -G amavis clamav 1>&2
218 fi
219
220 %post
221 /sbin/chkconfig --add clamd
222 %service clamd restart "Clam Antivirus daemon"
223 touch /var/log/freshclam.log
224 chown clamav:root /var/log/freshclam.log
225 chmod 640 /var/log/freshclam.log
226
227 %preun
228 if [ "$1" = "0" ]; then
229         %service clamd stop
230         /sbin/chkconfig --del clamd
231 fi
232
233 %postun
234 if [ "$1" = "0" ]; then
235         %userremove clamav
236         %groupremove clamav
237 fi
238
239 %triggerpostun -- %{name} <= 0.75.1
240 if [ -f /etc/clamav.conf.rpmsave ]; then
241         echo "Renaming config to new name /etc/clamd.conf"
242         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
243         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
244         echo "Changing config location in freshclam config"
245         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
246 fi
247
248 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
249 %{__cp} -f /etc/clamd.conf{,.rpmsave}
250 %{__sed} -i -e '
251                 s,^LogSyslog$,& yes,
252                 s,^FixStaleSocket$,& yes,
253                 s,^AllowSupplementaryGroups$,& yes,
254                 s,^ClamukoScanOnOpen$,& yes,
255                 s,^ClamukoScanOnClose$,& yes,
256                 s,^ClamukoScanOnExec$,& 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 TODO docs/*.pdf
284 %attr(755,root,root) %{_bindir}/clamdscan
285 %attr(755,root,root) %{_bindir}/clamscan
286 %attr(755,root,root) %{_bindir}/freshclam
287 %attr(755,root,root) %{_bindir}/sigtool
288 %attr(755,root,root) %{_bindir}/clamconf
289 %attr(755,root,root) %{_sbindir}/clamd
290 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
291 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
292 %attr(755,clamav,root) %dir /var/lib/%{name}
293 %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd
294 %attr(640,clamav,root) %ghost /var/log/freshclam.log
295 %attr(750,clamav,clamav) %dir /var/run/%{name}
296
297 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
298 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
299 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
300
301 %attr(754,root,root) /etc/rc.d/init.d/clamd
302 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
303 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
304 %{_mandir}/man[15]/*
305 %{_mandir}/man8/clamd*
306
307 %if %{with milter}
308 %files milter
309 %defattr(644,root,root,755)
310 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
311 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
312 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
313 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
314 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
315 %attr(755,root,root) %{_sbindir}/clamav-milter
316 %{_mandir}/man8/clamav-milter.8*
317 %attr(700,clamav,clamav) /var/spool/clamav
318 %endif
319
320 %files libs
321 %defattr(644,root,root,755)
322 %attr(755,root,root) %{_libdir}/lib*.so.*.*
323
324 %files devel
325 %defattr(644,root,root,755)
326 %attr(755,root,root) %{_bindir}/clamav-config
327 %attr(755,root,root) %{_libdir}/lib*.so
328 %{_libdir}/lib*.la
329 %{_includedir}/*.h
330 %{_pkgconfigdir}/*.pc
331
332 %files static
333 %defattr(644,root,root,755)
334 %{_libdir}/*.a
This page took 0.06843 seconds and 4 git commands to generate.