]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- update antivirus db once per 6h
[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.2
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 Patch0:         %{name}-pld_config.patch
22 URL:            http://www.clamav.net/
23 BuildRequires:  autoconf
24 BuildRequires:  automake
25 BuildRequires:  zlib-devel
26 Requires(post,preun):   /sbin/chkconfig
27 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28
29 %description
30 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
31 AMaViS, compressed files, uses the virus database from
32 OpenAntivirus.org, and includes a program for auto-updating. The
33 scanner is multithreaded, written in C, and POSIX compliant.
34
35 %description -l pl
36 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
37 uniksowych. Wspiera on AMaViSa, skompresowane pliki, u¿ywa bazy
38 wirusów z OpenAntivirus.org, i posiada system automatycznej
39 aktualizacji. Skaner jest wielow±tkowy, napisany w C i zgodny z
40 POSIXem.
41
42 %package libs
43 Summary:        Shared libraries for clamav
44 Summary(pl):    Biblioteki dzielone clamav
45 Group:          Libraries
46
47 %description libs
48 Shared libraries for clamav.
49
50 %description libs -l pl
51 Biblioteki dzielone clamav.
52
53 %package devel
54 Summary:        clamav - Development header files and libraries
55 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
56 Group:          Development/Libraries
57 Requires:       %{name}-libs = %{version}
58
59 %description devel
60 This package contains the development header files and libraries
61 necessary to develop clamav client applications.
62
63 %description devel -l pl
64 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
65 klienckich clamav.
66
67 %package static
68 Summary:        clamav static libraris
69 Summary(pl):    Biblioteki statyczne clamav
70 Group:          Development/Libraries
71 Requires:       %{name}-devel = %{version}
72
73 %description static
74 clamav static libraris.
75
76 %description static -l pl
77 Biblioteki statyczne clamav.
78
79 %package database
80 Summary:        Virus database for clamav
81 Summary(pl):    Bazy wirusów dla clamav
82 Group:          Applications
83 Version:        %{version}.%{database_version}
84 PreReq:         %{name}
85
86 %description database
87 Virus database for clamav (updated %{database_version})
88
89 %description database -l pl
90 Bazy wirusów dla clamav (aktualizowana %{database_version})
91
92 %prep
93 %setup -q -a 3
94 %patch0 -p1
95  
96 %build
97 rm -f missing
98 %{__aclocal}
99 %{__autoconf}
100 %{__automake}
101 %configure \
102         --disable-clamav \
103         --with-dbdir=/var/lib/%{name}
104 %{__make}
105 mv database/mirrors.txt{,.old}
106 echo clamav.sourceforge.net >database/mirrors.txt
107 cat database/mirrors.txt.old >>database/mirrors.txt
108
109 %install
110 rm -rf $RPM_BUILD_ROOT
111 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig} \
112         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/log}
113
114 %{__make} install \
115         DESTDIR=$RPM_BUILD_ROOT
116
117 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
118 0 */6 * * *     root    umask 022; %{_bindir}/freshclam --quiet -l %{_var}/log/%{name}.log --daemon-notify
119 EOF
120
121 touch $RPM_BUILD_ROOT%{_var}/log/%{name}.log
122
123 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
124 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
125 install etc/clamav.conf $RPM_BUILD_ROOT%{_sysconfdir}/
126
127 # NOTE: clamd uses sane rights to it's clamd.pid file
128 # So better keep it dir
129 # If it is fixed use of dir will be unecesary
130 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
131 # touch $RPM_BUILD_ROOT%{_var}/run/%{name}/clamd.pid
132
133 %clean
134 rm -rf $RPM_BUILD_ROOT
135
136 # FIXME: Does %triggerin -- amavis-ng really have to written three times ?
137 # It's stolen from mksd.spec - if it's wrong fix mksd.spec too
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 touch %{_var}/log/%{name}.log && chmod 640 %{_var}/log/%{name}.log && chown clamav %{_var}/log/%{name}.log
186 /sbin/chkconfig --add clamd
187 if [ -f /var/lock/subsys/clamd ]; then
188         /etc/rc.d/init.d/clamd restart >&2
189 else
190         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
191 fi
192
193 %preun
194 if [ "$1" = "0" ]; then
195         if [ -f /var/lock/subsys/clamd ]; then
196                 /etc/rc.d/init.d/clamd stop
197         fi
198         /sbin/chkconfig --del clamd
199 fi
200
201 %postun
202 if [ "$1" = "0" ]; then
203        echo "Removing user clamav"
204        /usr/sbin/userdel clamav
205        echo "Removing group clamav"
206        /usr/sbin/groupdel clamav
207 fi
208
209 %post   libs -p /sbin/ldconfig
210 %postun libs -p /sbin/ldconfig
211
212 %files
213 %defattr(644,root,root,755)
214 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
215 %attr(755,root,root) %{_bindir}/*
216 %attr(755,root,root) %{_sbindir}/*
217 %attr(755,clamav,root) %dir /var/lib/%{name}
218 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/mirrors.txt
219 %attr(640,clamav,root) %ghost %{_var}/log/%{name}.log
220 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
221 # %%attr(666,clamav,clamav) %%ghost %{_var}/run/%{name}/clamd.pid
222
223 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
224 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/*.conf
225 %attr(754,root,root) /etc/rc.d/init.d/clamd
226 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
227 %{_mandir}/man?/*
228
229 %files libs
230 %defattr(644,root,root,755)
231 %attr(755,root,root) %{_libdir}/lib*.so.*.*
232
233 %files devel
234 %defattr(644,root,root,755)
235 %attr(755,root,root) %{_libdir}/lib*.so
236 %{_libdir}/lib*.la
237 %{_includedir}/*.h
238
239 %files static
240 %defattr(644,root,root,755)
241 %{_libdir}/*.a
242
243 %files database
244 %defattr(644,root,root,755)
245 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.db*
This page took 0.049265 seconds and 4 git commands to generate.