]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- changelog fixed
[packages/clamav.git] / clamav.spec
1 # TODO:
2 #   Make freshclam (script and daemon)
3 #
4 # Conditional build:
5 %bcond_without  milter  # without milter subpackage
6 #
7 Summary:        An anti-virus utility for Unix
8 Summary(pl):    Antywirusowe narzêdzie dla Uniksów
9 Name:           clamav
10 Version:        0.75.1
11 Release:        2
12 License:        GPL
13 Group:          Applications
14 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
15 # Source0-md5:  2c85b7957eba9fd9e9ff8c2537ae006f
16 Source1:        %{name}.init
17 Source2:        %{name}.sysconfig
18 Source3:        %{name}-milter.init
19 Source4:        %{name}-cron-updatedb
20 Source5:        %{name}.logrotate
21 # Remember to update date after databases upgrade
22 %define         database_version        20040731
23 Source6:        http://www.clamav.net/database/daily.cvd
24 # Source6-md5:  8aa799fff39b3dd7c36a7dd796890b66
25 Source7:        http://www.clamav.net/database/main.cvd
26 # Source7-md5:  fb569320447dff5b22acdbec2dbc5772
27 Source8:        %{name}-post-updatedb
28 Source9:        %{name}-milter.sysconfig
29 Patch0:         %{name}-pld_config.patch
30 Patch1:         %{name}-no_auto_libwrap.patch
31 URL:            http://www.clamav.net/
32 BuildRequires:  autoconf
33 BuildRequires:  automake
34 BuildRequires:  gmp-devel
35 BuildRequires:  zlib-devel
36 Requires(post,preun):   /sbin/chkconfig
37 Requires:       %{name}-libs = %{version}-%{release}
38 Requires:       bc
39 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40
41 %description
42 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
43 AMaViS, compressed files, on-access scanning and includes a program
44 for auto-updating with support for digital signatures. The virus
45 database has over 20000 viruses, worms and trojans signatures. The
46 scanner is multithreaded, written in C, and POSIX compliant.
47
48 %description -l pl
49 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
50 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
51 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
52 Baza wirusów zawiera ponad 20000 sygnatur. Skaner jest wielow±tkowy,
53 napisany w C i zgodny z POSIXem.
54
55 %package libs
56 Summary:        Shared libraries for clamav
57 Summary(pl):    Biblioteki dzielone clamav
58 Group:          Libraries
59
60 %description libs
61 Shared libraries for clamav.
62
63 %description libs -l pl
64 Biblioteki dzielone clamav.
65
66 %package        milter
67 Summary:        Clamav milter
68 Group:          Daemons
69 Requires:       %{name} = %{epoch}:%{version}-%{release}
70 Requires:       sendmail >= 8.11
71 Requires:       tcp_wrappers
72 BuildRequires:  sendmail-devel >= 8.11
73 BuildRequires:  tcp_wrappers
74
75 %description milter
76 ClamAV sendmail filter using MILTER interface.
77
78 %description -l pl milter
79 Filtr ClamAV dla sendmaila korzystaj±cy z interfejsu MILTER.
80
81 %package devel
82 Summary:        clamav - Development header files and libraries
83 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
84 Group:          Development/Libraries
85 Requires:       %{name}-libs = %{version}-%{release}
86
87 %description devel
88 This package contains the development header files and libraries
89 necessary to develop clamav client applications.
90
91 %description devel -l pl
92 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
93 klienckich lclamav.
94
95 %package static
96 Summary:        clamav static libraris
97 Summary(pl):    Biblioteki statyczne clamav
98 Group:          Development/Libraries
99 Requires:       %{name}-devel = %{version}-%{release}
100
101 %description static
102 clamav static libraries.
103
104 %description static -l pl
105 Biblioteki statyczne clamav.
106
107 %package database
108 Summary:        Virus database for clamav
109 Summary(pl):    Bazy wirusów dla clamav
110 Group:          Applications
111 Version:        %{version}.%{database_version}
112 PreReq:         %{name}
113
114 %description database
115 Virus database for clamav (updated %{database_version}).
116
117 %description database -l pl
118 Bazy wirusów dla clamav (aktualizowana %{database_version}).
119
120 %prep
121 %setup -q
122 %patch0 -p1
123 %patch1 -p1
124
125 %build
126 %{__aclocal}
127 %{__autoconf}
128 %{__automake}
129 %configure \
130         --disable-clamav \
131         %{?_with_milter:--enable-milter} \
132         --with-dbdir=/var/lib/%{name}
133 %{__make}
134
135 %install
136 rm -rf $RPM_BUILD_ROOT
137 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
138         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/log}
139
140 %{__make} install \
141         DESTDIR=$RPM_BUILD_ROOT
142 %{?_without_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
143
144 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
145 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
146 EOF
147
148 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
149 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
150 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
151 install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
152 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
153 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}/
154 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
155 install %{SOURCE6} $RPM_BUILD_ROOT/var/lib/%{name}/
156 install %{SOURCE7} $RPM_BUILD_ROOT/var/lib/%{name}/
157 install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
158
159 # NOTE: clamd uses sane rights to it's clamd.pid file
160 # So better keep it dir
161 # If it is fixed use of dir will be unecesary
162 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
163
164 touch $RPM_BUILD_ROOT%{_var}/log/freshclam.log
165
166 %clean
167 rm -rf $RPM_BUILD_ROOT
168
169 %triggerin -- amavis-ng
170 AMAVIS=$(/usr/bin/getgid amavis)
171 RESULT=$?
172 if [ $RESULT -eq 0 ]; then
173         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
174         echo "adding clamav to amavis group GID=$AMAVIS"
175 fi
176
177 %triggerin -- amavisd-new
178 AMAVIS=$(/usr/bin/getgid amavis)
179 RESULT=$?
180 if [ $RESULT -eq 0 ]; then
181         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
182         echo "adding clamav to amavis group GID=$AMAVIS"
183 fi
184
185 %triggerin -- amavisd
186 AMAVIS=$(/usr/bin/getgid amavis)
187 RESULT=$?
188 if [ $RESULT -eq 0 ]; then
189         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
190         echo "adding clamav to amavis group GID=$AMAVIS"
191 fi
192
193 %pre
194 if [ -n "`getgid clamav`" ]; then
195         if [ "`getgid clamav`" != "43" ]; then
196                 echo "Warning: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
197                 exit 1
198         fi
199 else
200         echo "Adding group clamav GID=43"
201         /usr/sbin/groupadd -g 43 -r -f clamav
202 fi
203 if [ -n "`id -u clamav 2>/dev/null`" ]; then
204         if [ "`id -u clamav`" != "43" ]; then
205                 echo "Warning: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
206                 exit 1
207         fi
208 else
209         echo "Adding user clamav UID=43"
210         /usr/sbin/useradd -u 43 -r -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
211 fi
212
213 %post
214 /sbin/chkconfig --add clamd
215 if [ -f /var/lock/subsys/clamd ]; then
216         /etc/rc.d/init.d/clamd restart >&2
217 else
218         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
219 fi
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         if [ -f /var/lock/subsys/clamd ]; then
227                 /etc/rc.d/init.d/clamd stop
228         fi
229         /sbin/chkconfig --del clamd
230 fi
231
232 %postun
233 if [ "$1" = "0" ]; then
234         echo "Removing user clamav"
235         /usr/sbin/userdel clamav
236         echo "Removing group clamav"
237         /usr/sbin/groupdel clamav
238 fi
239
240 %post milter
241 /sbin/chkconfig --add clamav-milter
242 if [ -f /var/lock/subsys/clamav-milter ]; then
243         /etc/rc.d/init.d/clamd restart >&2
244 else
245         echo "Run \"/etc/rc.d/init.d/clamav-milter start\" to start Clam Antivirus daemon." >&2
246 fi
247
248 %preun milter
249 if [ "$1" = "0" ]; then
250         if [ -f /var/lock/subsys/clamav-milter ]; then
251                 /etc/rc.d/init.d/clamav-milter stop
252         fi
253         /sbin/chkconfig --del clamav-milter
254 fi
255
256 %post   libs -p /sbin/ldconfig
257 %postun libs -p /sbin/ldconfig
258
259 %post   database -p %{_sbindir}/%{name}-post-updatedb
260
261 %files
262 %defattr(644,root,root,755)
263 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
264 %attr(755,root,root) %{_bindir}/*
265 %attr(755,root,root) %{_sbindir}/*
266 %attr(755,clamav,root) %dir /var/lib/%{name}
267 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
268 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
269
270 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
271 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamav.conf
272 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
273
274 %attr(754,root,root) /etc/rc.d/init.d/clamd
275 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
276 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
277 %{_mandir}/man[15]/*
278 %{_mandir}/man8/clamd*
279
280 %if %{with milter}
281 %files milter
282 %defattr(644,root,root,755)
283 %config(noreplace) %{_sysconfdir}/sysconfig/clamav-milter
284 %attr(755,root,root) /etc/rc.d/init.d/clamav-milter
285 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
286 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
287 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
288 %attr(755,root,root) %{_sbindir}/clamav-milter
289 %{_mandir}/man8/clamav-milter.8*
290 %attr(700,clamav,clamav) /var/spool/clamav/
291 %endif
292
293 %files libs
294 %defattr(644,root,root,755)
295 %attr(755,root,root) %{_libdir}/lib*.so.*.*
296
297 %files devel
298 %defattr(644,root,root,755)
299 %attr(755,root,root) %{_libdir}/lib*.so
300 %{_libdir}/lib*.la
301 %{_includedir}/*.h
302 %{_pkgconfigdir}/*.pc
303
304 %files static
305 %defattr(644,root,root,755)
306 %{_libdir}/*.a
307
308 %files database
309 %defattr(644,root,root,755)
310 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.057445 seconds and 3 git commands to generate.