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