]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
625ed6a8777a13a448b8af303029f2b9b9c53b57
[packages/clamav.git] / clamav.spec
1 # TODO:
2 # - Fix inconsistency:
3 #   clamd uses syslog but log from (crond) db update goes to
4 #   /var/log/clamd.log
5
6 # Conditional build:
7 # _with_bigZIPOSDET  - increases zip file size
8 #  should be used with samba scanning, on smtp-server
9 #  may lead to DoS (memory usage up tu 1GB)
10 #  It's configurable in CVS version of clamav, anyway.
11
12 %define         database_version 20040210
13 Summary:        An anti-virus utility for Unix
14 Summary(pl):    Antywirusowe narzêdzie dla Unixów
15 Name:           clamav
16 Version:        0.65
17 Release:        7
18 License:        GPL
19 Group:          Applications
20 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
21 # Source0-md5:  f2b8473190b6dc1fd9c64b9ebc49a5ad
22 Source1:        %{name}.init
23 Source2:        %{name}.sysconfig
24 # bziped from http://www.clamav.net/database/
25 Source3:        %{name}-database-%{database_version}.tar.bz2
26 # Source3-md5:  4affa1cae8a0edaaaa084ea57702c1e8
27 Source4:        %{name}-cron-updatedb
28 Source5:        %{name}.logrotate
29 Patch0:         %{name}-pld_config.patch
30 Patch1:         %{name}-oversize_zip.patch
31 Patch2:         %{name}-remote_dos_exploit.patch
32 URL:            http://www.clamav.net/
33 BuildRequires:  autoconf
34 BuildRequires:  automake
35 BuildRequires:  zlib-devel
36 BuildRequires:  gmp-devel
37 Requires(post,preun):   /sbin/chkconfig
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, uses the virus database from
44 OpenAntivirus.org, and includes a program for auto-updating. The
45 scanner is multithreaded, written in C, and POSIX compliant.
46
47 %description -l pl
48 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
49 uniksowych. Wspiera on AMaViSa, skompresowane pliki, u¿ywa bazy
50 wirusów z OpenAntivirus.org, i posiada system automatycznej
51 aktualizacji. Skaner jest wielow±tkowy, napisany w C i zgodny z
52 POSIXem.
53
54 %package libs
55 Summary:        Shared libraries for clamav
56 Summary(pl):    Biblioteki dzielone clamav
57 Group:          Libraries
58
59 %description libs
60 Shared libraries for clamav.
61
62 %description libs -l pl
63 Biblioteki dzielone clamav.
64
65 %package devel
66 Summary:        clamav - Development header files and libraries
67 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
68 Group:          Development/Libraries
69 Requires:       %{name}-libs = %{version}
70
71 %description devel
72 This package contains the development header files and libraries
73 necessary to develop clamav client applications.
74
75 %description devel -l pl
76 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
77 klienckich clamav.
78
79 %package static
80 Summary:        clamav static libraris
81 Summary(pl):    Biblioteki statyczne clamav
82 Group:          Development/Libraries
83 Requires:       %{name}-devel = %{version}
84
85 %description static
86 clamav static libraris.
87
88 %description static -l pl
89 Biblioteki statyczne clamav.
90
91 %package database
92 Summary:        Virus database for clamav
93 Summary(pl):    Bazy wirusów dla clamav
94 Group:          Applications
95 Version:        %{version}.%{database_version}
96 PreReq:         %{name}
97
98 %description database
99 Virus database for clamav (updated %{database_version})
100
101 %description database -l pl
102 Bazy wirusów dla clamav (aktualizowana %{database_version})
103
104 %prep
105 %setup -q -a 3
106 %patch0 -p1
107 %{!?_with_bigZIPOSDET:%patch1 -p1}
108 %patch2 -p0
109
110 %build
111 rm -f missing
112 %{__aclocal}
113 %{__autoconf}
114 %{__automake}
115 %configure \
116         --disable-clamav \
117         --with-dbdir=/var/lib/%{name}
118 %{__make}
119 mv database/mirrors.txt{,.old}
120 echo clamav.sourceforge.net >database/mirrors.txt
121 cat database/mirrors.txt.old >>database/mirrors.txt
122
123 %install
124 rm -rf $RPM_BUILD_ROOT
125 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
126         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/log}
127
128 %{__make} install \
129         DESTDIR=$RPM_BUILD_ROOT
130
131 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
132 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
133 EOF
134
135 touch $RPM_BUILD_ROOT%{_var}/log/%{name}.log
136
137 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
138 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
139 install database/viruses.db* $RPM_BUILD_ROOT/var/lib/%{name}/
140 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
141 install etc/clamav.conf $RPM_BUILD_ROOT%{_sysconfdir}/
142 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
143
144 # NOTE: clamd uses sane rights to it's clamd.pid file
145 # So better keep it dir
146 # If it is fixed use of dir will be unecesary
147 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
148 # touch $RPM_BUILD_ROOT%{_var}/run/%{name}/clamd.pid
149
150 %clean
151 rm -rf $RPM_BUILD_ROOT
152
153 %triggerin -- amavis-ng
154 AMAVIS=$(/usr/bin/getgid amavis)
155 RESULT=$?
156 if [ $RESULT -eq 0 ]; then
157         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
158         echo "adding clamav to amavis group GID=$AMAVIS"
159 fi
160
161 %triggerin -- amavisd-new
162 AMAVIS=$(/usr/bin/getgid amavis)
163 RESULT=$?
164 if [ $RESULT -eq 0 ]; then
165         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
166         echo "adding clamav to amavis group GID=$AMAVIS"
167 fi
168
169 %triggerin -- amavisd
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
178 %pre 
179 if [ -n "`getgid clamav`" ]; then
180         if [ "`getgid clamav`" != "43" ]; then
181                 echo "Warning: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
182                 exit 1
183         fi
184 else
185         echo "Adding group clamav GID=43"
186         /usr/sbin/groupadd -g 43 -r -f clamav
187 fi
188 if [ -n "`id -u clamav 2>/dev/null`" ]; then
189         if [ "`id -u clamav`" != "43" ]; then
190                 echo "Warning: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
191                 exit 1
192         fi
193 else
194         echo "Adding user clamav UID=43"
195         /usr/sbin/useradd -u 43 -r -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
196 fi
197
198 %post
199 touch %{_var}/log/%{name}.log && chmod 640 %{_var}/log/%{name}.log && chown clamav %{_var}/log/%{name}.log
200 /sbin/chkconfig --add clamd
201 if [ -f /var/lock/subsys/clamd ]; then
202         /etc/rc.d/init.d/clamd restart >&2
203 else
204         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
205 fi
206
207 %preun
208 if [ "$1" = "0" ]; then
209         if [ -f /var/lock/subsys/clamd ]; then
210                 /etc/rc.d/init.d/clamd stop
211         fi
212         /sbin/chkconfig --del clamd
213 fi
214
215 %postun
216 if [ "$1" = "0" ]; then
217         echo "Removing user clamav"
218         /usr/sbin/userdel clamav
219         echo "Removing group clamav"
220         /usr/sbin/groupdel clamav
221 fi
222
223 %post   libs -p /sbin/ldconfig
224 %postun libs -p /sbin/ldconfig
225
226 %files
227 %defattr(644,root,root,755)
228 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
229 %attr(755,root,root) %{_bindir}/*
230 %attr(755,root,root) %{_sbindir}/*
231 %attr(755,clamav,root) %dir /var/lib/%{name}
232 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/mirrors.txt
233 %attr(640,clamav,root) %ghost %{_var}/log/%{name}.log
234 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
235 # %%attr(666,clamav,clamav) %%ghost %{_var}/run/%{name}/clamd.pid
236
237 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
238 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/*.conf
239 %attr(754,root,root) /etc/rc.d/init.d/clamd
240 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
241 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
242 %{_mandir}/man?/*
243
244 %files libs
245 %defattr(644,root,root,755)
246 %attr(755,root,root) %{_libdir}/lib*.so.*.*
247
248 %files devel
249 %defattr(644,root,root,755)
250 %attr(755,root,root) %{_libdir}/lib*.so
251 %{_libdir}/lib*.la
252 %{_includedir}/*.h
253
254 %files static
255 %defattr(644,root,root,755)
256 %{_libdir}/*.a
257
258 %files database
259 %defattr(644,root,root,755)
260 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.db*
This page took 0.052195 seconds and 3 git commands to generate.