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