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
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
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
32 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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.
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
48 Summary: Shared libraries for clamav
49 Summary(pl): Biblioteki dzielone clamav
53 Shared libraries for clamav.
55 %description libs -l pl
56 Biblioteki dzielone clamav.
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}
65 This package contains the development header files and libraries
66 necessary to develop clamav client applications.
68 %description devel -l pl
69 Pliki nag³ówkowe i biblioteki konieczne do kompilacji aplikacji
73 Summary: clamav static libraris
74 Summary(pl): Biblioteki statyczne clamav
75 Group: Development/Libraries
76 Requires: %{name}-devel = %{version}
79 clamav static libraries.
81 %description static -l pl
82 Biblioteki statyczne clamav.
85 Summary: Virus database for clamav
86 Summary(pl): Bazy wirusów dla clamav
88 Version: %{version}.%{database_version}
92 Virus database for clamav (updated %{database_version})
94 %description database -l pl
95 Bazy wirusów dla clamav (aktualizowana %{database_version})
108 --with-dbdir=/var/lib/%{name}
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}
117 DESTDIR=$RPM_BUILD_ROOT
119 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
120 5 * * * * root %{_sbindir}/clamav-cron-updatedb
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}
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
138 rm -rf $RPM_BUILD_ROOT
140 %triggerin -- amavis-ng
141 AMAVIS=$(/usr/bin/getgid amavis)
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"
148 %triggerin -- amavisd-new
149 AMAVIS=$(/usr/bin/getgid amavis)
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"
156 %triggerin -- amavisd
157 AMAVIS=$(/usr/bin/getgid amavis)
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"
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
172 echo "Adding group clamav GID=43"
173 /usr/sbin/groupadd -g 43 -r -f clamav
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
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
186 /sbin/chkconfig --add clamd
187 if [ -f /var/lock/subsys/clamd ]; then
188 /etc/rc.d/init.d/clamd restart >&2
190 echo "Run \"/etc/rc.d/init.d/clamd start\" to start Clam Antivirus daemon." >&2
194 if [ "$1" = "0" ]; then
195 if [ -f /var/lock/subsys/clamd ]; then
196 /etc/rc.d/init.d/clamd stop
198 /sbin/chkconfig --del clamd
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
209 %post libs -p /sbin/ldconfig
210 %postun libs -p /sbin/ldconfig
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}
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
230 %defattr(644,root,root,755)
231 %attr(755,root,root) %{_libdir}/lib*.so.*.*
234 %defattr(644,root,root,755)
235 %attr(755,root,root) %{_libdir}/lib*.so
240 %defattr(644,root,root,755)
244 %defattr(644,root,root,755)
245 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.db*