]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
802a65748e7bba6825d448f52af870e1274fcad4
[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 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %description
31 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
32 AMaViS, compressed files, uses the virus database from
33 OpenAntivirus.org, and includes a program for auto-updating. The
34 scanner is multithreaded, written in C, and POSIX compliant.
35
36 %description -l pl
37 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
38 uniksowych. Wspiera on AMaViSa, skompresowane pliki, u¿ywa bazy
39 wirusów z OpenAntivirus.org, i posiada system automatycznej
40 aktualizacji. Skaner jest wielow±tkowy, napisany w C i zgodny z
41 POSIXem.
42
43 %package libs
44 Summary:        Shared libraries for clamav
45 Summary(pl):    Biblioteki dzielone clamav
46 Group:          Libraries
47
48 %description libs
49 Shared libraries for clamav.
50
51 %description libs -l pl
52 Biblioteki dzielone clamav.
53
54 %package devel
55 Summary:        clamav - Development header files and libraries
56 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
57 Group:          Development/Libraries
58 Requires:       %{name}-libs = %{version}
59
60 %description devel
61 This package contains the development header files and libraries
62 necessary to develop clamav client applications.
63
64 %description devel -l pl
65 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
66 klienckich clamav.
67
68 %package static
69 Summary:        clamav static libraris
70 Summary(pl):    Biblioteki statyczne clamav
71 Group:          Development/Libraries
72 Requires:       %{name}-devel = %{version}
73
74 %description static
75 clamav static libraris.
76
77 %description static -l pl
78 Biblioteki statyczne clamav.
79
80 %package database
81 Summary:        Virus database for clamav
82 Summary(pl):    Bazy wirusów dla clamav
83 Group:          Applications
84 Version:        %{version}.%{database_version}
85 PreReq:         %{name}
86
87 %description database
88 Virus database for clamav (updated %{database_version})
89
90 %description database -l pl
91 Bazy wirusów dla clamav (aktualizowana %{database_version})
92
93 %prep
94 %setup -q -a 3
95 %patch0 -p1
96  
97 %build
98 rm -f missing
99 %{__aclocal}
100 %{__autoconf}
101 %{__automake}
102 %configure \
103         --disable-clamav \
104         --with-dbdir=/var/lib/%{name}
105 %{__make}
106 mv database/mirrors.txt{,.old}
107 echo clamav.sourceforge.net >database/mirrors.txt
108 cat database/mirrors.txt.old >>database/mirrors.txt
109
110 %install
111 rm -rf $RPM_BUILD_ROOT
112 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig} \
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 touch $RPM_BUILD_ROOT%{_var}/log/%{name}.log
123
124 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
125 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
126 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
127 install etc/clamav.conf $RPM_BUILD_ROOT%{_sysconfdir}/
128
129 # NOTE: clamd uses sane rights to it's clamd.pid file
130 # So better keep it dir
131 # If it is fixed use of dir will be unecesary
132 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
133 # touch $RPM_BUILD_ROOT%{_var}/run/%{name}/clamd.pid
134
135 %clean
136 rm -rf $RPM_BUILD_ROOT
137
138 # FIXME: Does %triggerin -- amavis-ng really have to written three times ?
139 # It's stolen from mksd.spec - if it's wrong fix mksd.spec too
140
141 %triggerin -- amavis-ng
142 AMAVIS=$(/usr/bin/getgid amavis)
143 RESULT=$?
144 if  [ $RESULT -eq 0 ]; then
145         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
146         echo "adding clamav to amavis group GID=$AMAVIS"
147 fi
148
149 %triggerin -- amavisd-new
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
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
166 %pre
167 if [ -n "`getgid clamav`" ]; then
168         if [ "`getgid clamav`" != "43" ]; then
169                 echo "Warning: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
170                 exit 1
171         fi
172 else
173        echo "Adding group clamav GID=43"
174         /usr/sbin/groupadd -g 43 -r -f clamav
175 fi
176 if [ -n "`id -u clamav 2>/dev/null`" ]; then
177        if [ "`id -u clamav`" != "43" ]; then
178                echo "Warning: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
179                exit 1
180        fi
181 else
182        echo "Adding user clamav UID=43"
183        /usr/sbin/useradd -u 43 -r -d /tmp  -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
184 fi
185
186 %post
187 touch %{_var}/log/%{name}.log && chmod 640 %{_var}/log/%{name}.log && chown clamav %{_var}/log/%{name}.log
188 /sbin/chkconfig --add clamd
189 if [ -f /var/lock/subsys/clamd ]; then
190         /etc/rc.d/init.d/clamd restart >&2
191 else
192         echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
193 fi
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(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/mirrors.txt
221 %attr(640,clamav,root) %ghost %{_var}/log/%{name}.log
222 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
223 # %%attr(666,clamav,clamav) %%ghost %{_var}/run/%{name}/clamd.pid
224
225 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
226 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/*.conf
227 %attr(754,root,root) /etc/rc.d/init.d/clamd
228 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
229 %{_mandir}/man?/*
230
231 %files libs
232 %defattr(644,root,root,755)
233 %attr(755,root,root) %{_libdir}/lib*.so.*.*
234
235 %files devel
236 %defattr(644,root,root,755)
237 %attr(755,root,root) %{_libdir}/lib*.so
238 %{_libdir}/lib*.la
239 %{_includedir}/*.h
240
241 %files static
242 %defattr(644,root,root,755)
243 %{_libdir}/*.a
244
245 %files database
246 %defattr(644,root,root,755)
247 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.db*
This page took 0.19553 seconds and 3 git commands to generate.