]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- tabs in preamble
[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             rc3
9 %define         _rel    1
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:  5af2bdbbb255829dd590609d900c1854
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 %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 TODO 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.061125 seconds and 4 git commands to generate.