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