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