]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
e4ef8c6b6dde82ec242ac20885ac07ea6832af4e
[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    4
10 Summary:        An anti-virus utility for Unix
11 Summary(pl.UTF-8):   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 Patch3:         %{name}-find_milter.patch
31 URL:            http://www.clamav.net/
32 BuildRequires:  autoconf
33 BuildRequires:  automake
34 BuildRequires:  bzip2-devel
35 %{?with_curl:BuildRequires:     curl-devel}
36 BuildRequires:  gmp-devel
37 BuildRequires:  libtool
38 %{?with_milter:BuildRequires:   libwrap-devel}
39 BuildRequires:  rpmbuild(macros) >= 1.268
40 %{?with_milter:BuildRequires:   libmilter-devel}
41 BuildRequires:  zlib-devel
42 Requires(post,preun):   /sbin/chkconfig
43 Requires(postun):       /usr/sbin/groupdel
44 Requires(postun):       /usr/sbin/userdel
45 Requires(postun,pre):   /usr/sbin/usermod
46 Requires(pre):  /bin/id
47 Requires(pre):  /usr/bin/getgid
48 Requires(pre):  /usr/sbin/groupadd
49 Requires(pre):  /usr/sbin/useradd
50 Requires(triggerpostun):        sed >= 4.0
51 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
52 Requires:       /usr/sbin/usermod
53 Requires:       bc
54 Requires:       rc-scripts
55 Provides:       group(clamav)
56 Provides:       user(clamav)
57 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
58
59 %description
60 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
61 AMaViS, compressed files, on-access scanning and includes a program
62 for auto-updating with support for digital signatures. The virus
63 database has over 85387 viruses, worms and trojans signatures. The
64 scanner is multithreaded, written in C, and POSIX compliant.
65
66 %description -l pl.UTF-8
67 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
68 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
69 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
70 Baza wirusów zawiera ponad 85387 sygnatur. Skaner jest wielowątkowy,
71 napisany w C i zgodny z POSIXem.
72
73 %package libs
74 Summary:        Shared libraries for clamav
75 Summary(pl.UTF-8):   Biblioteki dzielone clamav
76 Group:          Libraries
77
78 %description libs
79 Shared libraries for clamav.
80
81 %description libs -l pl.UTF-8
82 Biblioteki dzielone clamav.
83
84 %package milter
85 Summary:        ClamAV filter using milter interface
86 Summary(pl.UTF-8):   Filtr ClamAV korzystający z interfejsu milter
87 Group:          Daemons
88 Requires:       %{name} = %{epoch}:%{version}-%{release}
89 Requires:       sendmail >= 8.11
90 Requires:       tcp_wrappers
91
92 %description milter
93 ClamAV sendmail filter using MILTER interface.
94
95 %description milter -l pl.UTF-8
96 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
97
98 %package devel
99 Summary:        clamav - Development header files and libraries
100 Summary(pl.UTF-8):   clamav - Pliki nagłówkowe i biblioteki dla programistów
101 Group:          Development/Libraries
102 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
103 Requires:       bzip2-devel
104 Requires:       gmp-devel
105 Requires:       zlib-devel
106
107 %description devel
108 This package contains the development header files and libraries
109 necessary to develop clamav client applications.
110
111 %description devel -l pl.UTF-8
112 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
113 klienckich clamav.
114
115 %package static
116 Summary:        clamav static libraries
117 Summary(pl.UTF-8):   Biblioteki statyczne clamav
118 Group:          Development/Libraries
119 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
120
121 %description static
122 clamav static libraries.
123
124 %description static -l pl.UTF-8
125 Biblioteki statyczne clamav.
126
127 %prep
128 %setup -q %{?_rc:-n %{name}-%{version}%{_rc}}
129 %patch0 -p1
130 %patch1 -p1
131 %patch2 -p1
132 %patch3 -p0
133
134 # kill old libtool.m4 copy
135 head -n 489 acinclude.m4 > acinclude.m4.tmp
136 tail -n +4089 acinclude.m4 >> acinclude.m4.tmp
137 mv -f acinclude.m4.tmp acinclude.m4
138
139 %build
140 %{__libtoolize}
141 %{__aclocal}
142 %{__autoconf}
143 %{__autoheader}
144 %{__automake}
145 %configure \
146         --disable-clamav \
147         %{!?with_curl:--without-libcurl} \
148         %{?with_milter:--enable-milter} \
149         --with-dbdir=/var/lib/%{name}
150 %{__make}
151
152 %install
153 rm -rf $RPM_BUILD_ROOT
154 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
155         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav}
156
157 %{__make} install \
158         DESTDIR=$RPM_BUILD_ROOT
159 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
160
161 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
162 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
163 EOF
164
165 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
166 %if %{with milter}
167 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
168 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
169 %endif
170 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
171 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
172 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
173 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
174
175 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
176
177 # NOTE: clamd uses sane rights to it's clamd.pid file
178 # So better keep it dir
179 # If it is fixed use of dir will be unecesary
180 install -d $RPM_BUILD_ROOT/var/run/%{name}
181
182 :> $RPM_BUILD_ROOT/var/log/freshclam.log
183
184 %clean
185 rm -rf $RPM_BUILD_ROOT
186
187 %triggerin -- amavis-ng
188 AMAVIS=$(/usr/bin/getgid amavis)
189 RESULT=$?
190 if [ $RESULT -eq 0 ]; then
191         echo "Adding clamav to amavis group GID=$AMAVIS"
192         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
193 fi
194
195 %triggerin -- amavisd-new
196 AMAVIS=$(/usr/bin/getgid amavis)
197 RESULT=$?
198 if [ $RESULT -eq 0 ]; then
199         echo "Adding clamav to amavis group GID=$AMAVIS"
200         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
201 fi
202
203 %triggerin -- amavisd
204 AMAVIS=$(/usr/bin/getgid amavis)
205 RESULT=$?
206 if [ $RESULT -eq 0 ]; then
207         echo "Adding clamav to amavis group GID=$AMAVIS"
208         /usr/sbin/usermod -G amavis clamav 1>&2
209 fi
210
211 %pre
212 %groupadd -g 43 clamav
213 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
214
215 # FIXME: check this. is it proper after useradd macro?
216 # TODO: use addusertogroup macro?
217 if [ -n "`/usr/bin/getgid amavis`" ]; then
218         echo "Adding clamav to amavis group"
219         /usr/sbin/usermod -G amavis clamav 1>&2
220 fi
221
222 %post
223 /sbin/chkconfig --add clamd
224 %service clamd restart "Clam Antivirus daemon"
225 touch /var/log/freshclam.log
226 chown clamav:root /var/log/freshclam.log
227 chmod 640 /var/log/freshclam.log
228
229 %preun
230 if [ "$1" = "0" ]; then
231         %service clamd stop
232         /sbin/chkconfig --del clamd
233 fi
234
235 %postun
236 if [ "$1" = "0" ]; then
237         %userremove clamav
238         %groupremove clamav
239 fi
240
241 %triggerpostun -- %{name} <= 0.75.1
242 if [ -f /etc/clamav.conf.rpmsave ]; then
243         echo "Renaming config to new name /etc/clamd.conf"
244         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
245         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
246         echo "Changing config location in freshclam config"
247         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
248 fi
249
250 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
251 %{__cp} -f /etc/clamd.conf{,.rpmsave}
252 %{__sed} -i -e '
253                 s,^LogSyslog$,& yes,
254                 s,^FixStaleSocket$,& yes,
255                 s,^AllowSupplementaryGroups$,& yes,
256                 s,^ClamukoScanOnOpen$,& yes,
257                 s,^ClamukoScanOnClose$,& yes,
258                 s,^ClamukoScanOnExec$,& yes,
259 ' /etc/clamd.conf
260 %banner -e %{name}-0.90 <<EOF
261 ClamAV config was automatically upgraded to 0.90 format. You should review it
262 that it's still valid.
263 EOF
264 #'
265 # unfortunately clamd has no configcheck option so we just have to start it
266 # once again after config was broken after upgrade
267 touch /var/lock/subsys/clamd
268 %service -q clamd restart
269
270 %post milter
271 /sbin/chkconfig --add clamav-milter
272 %service clamav-milter restart "Clam Antivirus daemon"
273
274 %preun milter
275 if [ "$1" = "0" ]; then
276         %service clamav-milter stop
277         /sbin/chkconfig --del clamav-milter
278 fi
279
280 %post   libs -p /sbin/ldconfig
281 %postun libs -p /sbin/ldconfig
282
283 %files
284 %defattr(644,root,root,755)
285 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/*.pdf
286 %attr(755,root,root) %{_bindir}/clamdscan
287 %attr(755,root,root) %{_bindir}/clamscan
288 %attr(755,root,root) %{_bindir}/freshclam
289 %attr(755,root,root) %{_bindir}/sigtool
290 %attr(755,root,root) %{_bindir}/clamconf
291 %attr(755,root,root) %{_sbindir}/clamd
292 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
293 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
294 %attr(755,clamav,root) %dir /var/lib/%{name}
295 %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd
296 %attr(640,clamav,root) %ghost /var/log/freshclam.log
297 %attr(750,clamav,clamav) %dir /var/run/%{name}
298
299 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
300 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
301 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
302
303 %attr(754,root,root) /etc/rc.d/init.d/clamd
304 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
305 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
306 %{_mandir}/man[15]/*
307 %{_mandir}/man8/clamd*
308
309 %if %{with milter}
310 %files milter
311 %defattr(644,root,root,755)
312 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
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
326 %files devel
327 %defattr(644,root,root,755)
328 %attr(755,root,root) %{_bindir}/clamav-config
329 %attr(755,root,root) %{_libdir}/lib*.so
330 %{_libdir}/lib*.la
331 %{_includedir}/*.h
332 %{_pkgconfigdir}/*.pc
333
334 %files static
335 %defattr(644,root,root,755)
336 %{_libdir}/*.a
This page took 0.086533 seconds and 2 git commands to generate.