2 # Make freshclam (script and daemon)
3 # log nicely via syslog to /var/log/freshclam.log
5 %define database_version 20040210
6 Summary: An anti-virus utility for Unix
7 Summary(pl): Antywirusowe narzêdzie dla Unixów
10 Version: %(echo %{_ver} | tr - .)
14 Source0: http://dl.sourceforge.net/clamav/%{name}-%{_ver}.tar.gz
15 # Source0-md5: e53d65fe2f7d4146f146c5720313381e
17 Source2: %{name}.sysconfig
18 # bziped from http://www.clamav.net/database/
19 # Source3: %{name}-database-%{database_version}.tar.bz2
20 # Source3-md5: 4affa1cae8a0edaaaa084ea57702c1e8
21 Source4: %{name}-cron-updatedb
22 Source5: %{name}.logrotate
23 Patch0: %{name}-pld_config.patch
24 URL: http://www.clamav.net/
25 BuildRequires: autoconf
26 BuildRequires: automake
27 BuildRequires: zlib-devel
28 BuildRequires: gmp-devel
29 Requires(post,preun): /sbin/chkconfig
31 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34 Clam Antivirus is a powerful anti-virus scanner for Unix. It supports
35 AMaViS, compressed files, uses the virus database from
36 OpenAntivirus.org, and includes a program for auto-updating. The
37 scanner is multithreaded, written in C, and POSIX compliant.
40 Clam Antivirus jest potê¿nym skanerem antywirusowym dla systemów
41 uniksowych. Wspiera on AMaViSa, skompresowane pliki, u¿ywa bazy
42 wirusów z OpenAntivirus.org, i posiada system automatycznej
43 aktualizacji. Skaner jest wielow±tkowy, napisany w C i zgodny z
47 Summary: Shared libraries for clamav
48 Summary(pl): Biblioteki dzielone clamav
52 Shared libraries for clamav.
54 %description libs -l pl
55 Biblioteki dzielone clamav.
58 Summary: clamav - Development header files and libraries
59 Summary(pl): clamav - Pliki nag³ówkowe i biblioteki dla programistów
60 Group: Development/Libraries
61 Requires: %{name}-libs = %{version}
64 This package contains the development header files and libraries
65 necessary to develop clamav client applications.
67 %description devel -l pl
68 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
72 Summary: clamav static libraris
73 Summary(pl): Biblioteki statyczne clamav
74 Group: Development/Libraries
75 Requires: %{name}-devel = %{version}
78 clamav static libraries.
80 %description static -l pl
81 Biblioteki statyczne clamav.
84 Summary: Virus database for clamav
85 Summary(pl): Bazy wirusów dla clamav
87 Version: %{version}.%{database_version}
91 Virus database for clamav (updated %{database_version})
93 %description database -l pl
94 Bazy wirusów dla clamav (aktualizowana %{database_version})
97 %setup -q -n %{name}-%{_ver}
107 --with-dbdir=/var/lib/%{name}
111 rm -rf $RPM_BUILD_ROOT
112 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
113 $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/log}
116 DESTDIR=$RPM_BUILD_ROOT
118 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
119 5 * * * * root %{_sbindir}/clamav-cron-updatedb
123 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
124 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
125 install database/*.cvd $RPM_BUILD_ROOT/var/lib/%{name}/
126 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
127 install etc/clamav.conf $RPM_BUILD_ROOT%{_sysconfdir}/
128 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
130 # NOTE: clamd uses sane rights to it's clamd.pid file
131 # So better keep it dir
132 # If it is fixed use of dir will be unecesary
133 install -d $RPM_BUILD_ROOT%{_var}/run/%{name}
134 touch $RPM_BUILD_ROOT%{_var}/log/freshclam.log
137 rm -rf $RPM_BUILD_ROOT
139 %triggerin -- amavis-ng
140 AMAVIS=$(/usr/bin/getgid amavis)
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"
147 %triggerin -- amavisd-new
148 AMAVIS=$(/usr/bin/getgid amavis)
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"
155 %triggerin -- amavisd
156 AMAVIS=$(/usr/bin/getgid amavis)
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"
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
171 echo "Adding group clamav GID=43"
172 /usr/sbin/groupadd -g 43 -r -f clamav
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
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
185 /sbin/chkconfig --add clamd
186 if [ -f /var/lock/subsys/clamd ]; then
187 /etc/rc.d/init.d/clamd restart >&2
189 echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
191 touch %{_var}/log/freshclam.log
192 chown clamav:root %{_var}/log/freshclam.log
193 chmod 640 %{_var}/log/freshclam.log
196 if [ "$1" = "0" ]; then
197 if [ -f /var/lock/subsys/clamd ]; then
198 /etc/rc.d/init.d/clamd stop
200 /sbin/chkconfig --del clamd
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
211 %post libs -p /sbin/ldconfig
212 %postun libs -p /sbin/ldconfig
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(640,clamav,root) %ghost %{_var}/log/%{name}.log
221 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
222 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
224 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
225 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamav.conf
226 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
228 %attr(754,root,root) /etc/rc.d/init.d/clamd
229 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
230 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
234 %defattr(644,root,root,755)
235 %attr(755,root,root) %{_libdir}/lib*.so.*.*
238 %defattr(644,root,root,755)
239 %attr(755,root,root) %{_libdir}/lib*.so
244 %defattr(644,root,root,755)
248 %defattr(644,root,root,755)
249 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd