]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
022f0641802de26579d910751f40d61cbf04b2ac
[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 Summary:        An anti-virus utility for Unix
6 Summary(pl):    Antywirusowe narzêdzie dla Uniksów
7 Name:           clamav
8 Version:        0.70
9 Release:        1
10 License:        GPL
11 Group:          Applications
12 Source0:        http://dl.sourceforge.net/clamav/%{name}-%{version}.tar.gz
13 # Source0-md5:  2599a2e6b06d1f8ca09fdef8bc17625c
14 Source1:        %{name}.init
15 Source2:        %{name}.sysconfig
16 Source4:        %{name}-cron-updatedb
17 Source5:        %{name}.logrotate
18 # Remember to update date on each rebuild!!
19 %define         database_version 20040416
20 Source6:        http://www.clamav.net/database/daily.cvd
21 # Source6-md5:  b7956b9c4850fdca0d3fca806c95ddc7
22 Source7:        http://www.clamav.net/database/main.cvd
23 # Source7-md5:  e85d9a1c57005458c3208bf94a888706
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 # -n %{name}-%{_ver}
102 %patch0 -p1
103 %patch1 -p1
104
105 %build
106 %{__aclocal}
107 %{__autoconf}
108 %{__automake}
109 %configure \
110         --disable-clamav \
111         --with-dbdir=/var/lib/%{name}
112 %{__make}
113
114 %install
115 rm -rf $RPM_BUILD_ROOT
116 install -d $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig,logrotate.d} \
117         $RPM_BUILD_ROOT{%{_sysconfdir}/cron.d,%{_var}/log}
118
119 %{__make} install \
120         DESTDIR=$RPM_BUILD_ROOT
121
122 cat <<EOF >$RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
123 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
124 EOF
125
126
127 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
128 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
129 install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
130 install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}/
131 install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
132 install %{SOURCE6} $RPM_BUILD_ROOT/var/lib/%{name}/
133 install %{SOURCE7} $RPM_BUILD_ROOT/var/lib/%{name}/
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 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 %files
220 %defattr(644,root,root,755)
221 %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/html/
222 %attr(755,root,root) %{_bindir}/*
223 %attr(755,root,root) %{_sbindir}/*
224 %attr(755,clamav,root) %dir /var/lib/%{name}
225 #%%attr(640,clamav,root) %ghost %{_var}/log/%{name}.log
226 %attr(640,clamav,root) %ghost %{_var}/log/freshclam.log
227 %attr(750,clamav,clamav) %dir %{_var}/run/%{name}
228
229 %attr(640,root,root) %{_sysconfdir}/cron.d/%{name}
230 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/clamav.conf
231 %attr(644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/freshclam.conf
232
233 %attr(754,root,root) /etc/rc.d/init.d/clamd
234 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/clamd
235 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/clamav
236 %{_mandir}/man?/*
237
238 %files libs
239 %defattr(644,root,root,755)
240 %attr(755,root,root) %{_libdir}/lib*.so.*.*
241
242 %files devel
243 %defattr(644,root,root,755)
244 %attr(755,root,root) %{_libdir}/lib*.so
245 %{_libdir}/lib*.la
246 %{_includedir}/*.h
247
248 %files static
249 %defattr(644,root,root,755)
250 %{_libdir}/*.a
251
252 %files database
253 %defattr(644,root,root,755)
254 %attr(644,clamav,root) %verify(not md5 size mtime) /var/lib/%{name}/*.cvd
This page took 0.039664 seconds and 2 git commands to generate.