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