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