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