]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
fbd30c9eff6303de58f86b1d20902d8d58c4b871
[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 Version:        0.66
10 Release:        2
11 License:        GPL
12 Group:          Applications
13 # Source0:      http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
14 # Temporary url - sf is under maintanance
15 Source0:        http://clamav.catt.com/stable/clamav-0.66.tar.gz
16 # Source0-md5:  f0a5d7f35106fb7b176bca5cd28a1bed
17 Source1:        %{name}.init
18 Source2:        %{name}.sysconfig
19 # bziped from http://www.clamav.net/database/
20 Source3:        %{name}-database-%{database_version}.tar.bz2
21 # Source3-md5:  4affa1cae8a0edaaaa084ea57702c1e8
22 Source4:        %{name}-cron-updatedb
23 Source5:        %{name}.logrotate
24 Patch0:         %{name}-pld_config.patch
25 URL:            http://www.clamav.net/
26 BuildRequires:  autoconf
27 BuildRequires:  automake
28 BuildRequires:  zlib-devel
29 BuildRequires:  gmp-devel
30 Requires(post,preun):   /sbin/chkconfig
31 Requires:       bc
32 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
33
34 %description
35 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
36 AMaViS, compressed files, uses the virus database from
37 OpenAntivirus.org, and includes a program for auto-updating. The
38 scanner is multithreaded, written in C, and POSIX compliant.
39
40 %description -l pl
41 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
42 uniksowych. Wspiera on AMaViSa, skompresowane pliki, u¿ywa bazy
43 wirusów z OpenAntivirus.org, i posiada system automatycznej
44 aktualizacji. Skaner jest wielow±tkowy, napisany w C i zgodny z
45 POSIXem.
46
47 %package libs
48 Summary:        Shared libraries for clamav
49 Summary(pl):    Biblioteki dzielone clamav
50 Group:          Libraries
51
52 %description libs
53 Shared libraries for clamav.
54
55 %description libs -l pl
56 Biblioteki dzielone clamav.
57
58 %package devel
59 Summary:        clamav - Development header files and libraries
60 Summary(pl):    clamav - Pliki nag³ówkowe i biblioteki dla programistów
61 Group:          Development/Libraries
62 Requires:       %{name}-libs = %{version}
63
64 %description devel
65 This package contains the development header files and libraries
66 necessary to develop clamav client applications.
67
68 %description devel -l pl
69 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
70 klienckich clamav.
71
72 %package static
73 Summary:        clamav static libraris
74 Summary(pl):    Biblioteki statyczne clamav
75 Group:          Development/Libraries
76 Requires:       %{name}-devel = %{version}
77
78 %description static
79 clamav static libraries.
80
81 %description static -l pl
82 Biblioteki statyczne clamav.
83
84 %package database
85 Summary:        Virus database for clamav
86 Summary(pl):    Bazy wirusów dla clamav
87 Group:          Applications
88 Version:        %{version}.%{database_version}
89 PreReq:         %{name}
90
91 %description database
92 Virus database for clamav (updated %{database_version})
93
94 %description database -l pl
95 Bazy wirusów dla clamav (aktualizowana %{database_version})
96
97 %prep
98 %setup -q -a 3
99 %patch0 -p1
100
101 %build
102 rm -f missing
103 %{__aclocal}
104 %{__autoconf}
105 %{__automake}
106 %configure \
107         --disable-clamav \
108         --with-dbdir=/var/lib/%{name}
109 %{__make}
110
111 %install
112 rm -rf $RPM_BUILD_ROOT
113 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
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
124 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
125 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
126 install database/viruses.db* $RPM_BUILD_ROOT/var/lib/%{name}/
127 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
128 install etc/clamav.conf $RPM_BUILD_ROOT%{_sysconfdir}/
129 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
130
131 # NOTE: clamd uses sane rights to it's clamd.pid file
132 # So better keep it dir
133 # If it is fixed use of dir will be unecesary
134 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
135 touch $RPM_BUILD_ROOT%{_var}/log/freshclam.log
136
137 %clean
138 rm -rf $RPM_BUILD_ROOT
139
140 %triggerin -- amavis-ng
141 AMAVIS=$(/usr/bin/getgid amavis)
142 RESULT=$?
143 if [ $RESULT -eq 0 ]; then
144         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
145         echo "adding clamav to amavis group GID=$AMAVIS"
146 fi
147
148 %triggerin -- amavisd-new
149 AMAVIS=$(/usr/bin/getgid amavis)
150 RESULT=$?
151 if [ $RESULT -eq 0 ]; then
152         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
153         echo "adding clamav to amavis group GID=$AMAVIS"
154 fi
155
156 %triggerin -- amavisd
157 AMAVIS=$(/usr/bin/getgid amavis)
158 RESULT=$?
159 if [ $RESULT -eq 0 ]; then
160         /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null
161         echo "adding clamav to amavis group GID=$AMAVIS"
162 fi
163
164
165 %pre 
166 if [ -n "`getgid clamav`" ]; then
167         if [ "`getgid clamav`" != "43" ]; then
168                 echo "Warning: group clamav doesn't have gid=43. Correct this before installing clamav" 1>&2
169                 exit 1
170         fi
171 else
172         echo "Adding group clamav GID=43"
173         /usr/sbin/groupadd -g 43 -r -f clamav
174 fi
175 if [ -n "`id -u clamav 2>/dev/null`" ]; then
176         if [ "`id -u clamav`" != "43" ]; then
177                 echo "Warning: user clamav doesn't have uid=43. Correct this before installing clamav" 1>&2
178                 exit 1
179         fi
180 else
181         echo "Adding user clamav UID=43"
182         /usr/sbin/useradd -u 43 -r -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav 1>&2
183 fi
184
185 %post
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(640,clamav,root) %ghost %{_var}/log/%{name}.log
219 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
220 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
221
222 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
223 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/*.conf
224 %attr(754,root,root) /etc/rc.d/init.d/clamd
225 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
226 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
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.035956 seconds and 3 git commands to generate.