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