]>
Commit | Line | Data |
---|---|---|
c935072a | 1 | # TODO: |
c8321415 | 2 | # - Make freshclam package (script and daemon) |
eba74cc1 | 3 | # |
4 | # Conditional build: | |
88439ba9 | 5 | %bcond_without milter # build without milter subpackage |
88439ba9 | 6 | %bcond_with curl # enable curl support |
eba74cc1 | 7 | # |
c8321415 | 8 | %define _rc rc2 |
ccb78c9d | 9 | %define _rel 4 |
b014d766 | 10 | Summary: An anti-virus utility for Unix |
d8cf2de3 | 11 | Summary(pl.UTF-8): Narzędzie antywirusowe dla Uniksów |
e6c034d3 | 12 | Name: clamav |
c8321415 | 13 | Version: 0.90 |
8239cb80 | 14 | Release: 0.%{_rc}.%{_rel} |
e77f89d2 | 15 | Epoch: 0 |
92c5ef39 | 16 | License: GPL |
4460ff0b | 17 | Group: Applications |
d78cc52a | 18 | Source0: http://dl.sourceforge.net/clamav/%{name}-%{version}%{_rc}.tar.gz |
8239cb80 | 19 | # Source0-md5: 91da47456ed28a7cfbfe17b033e15121 |
4460ff0b AM |
20 | Source1: %{name}.init |
21 | Source2: %{name}.sysconfig | |
eba74cc1 | 22 | Source3: %{name}-milter.init |
719d471d | 23 | Source4: %{name}-cron-updatedb |
4a3f68d7 | 24 | Source5: %{name}.logrotate |
3e84b306 | 25 | Source8: %{name}-post-updatedb |
eba74cc1 | 26 | Source9: %{name}-milter.sysconfig |
1475e7a3 | 27 | Patch0: %{name}-pld_config.patch |
83eaf0c7 | 28 | Patch1: %{name}-no_auto_libwrap.patch |
82747f5b | 29 | Patch2: %{name}-nolibs.patch |
4ffd87a3 | 30 | Patch3: %{name}-find_milter.patch |
182b1736 | 31 | URL: http://www.clamav.net/ |
e6c034d3 | 32 | BuildRequires: autoconf |
33 | BuildRequires: automake | |
bc21dbca | 34 | BuildRequires: bzip2-devel |
a3809365 | 35 | %{?with_curl:BuildRequires: curl-devel} |
73b401c8 | 36 | BuildRequires: gmp-devel |
2d1a6e1f | 37 | BuildRequires: libtool |
dd6d36d5 ER |
38 | %{?with_milter:BuildRequires: libwrap-devel} |
39 | BuildRequires: rpmbuild(macros) >= 1.268 | |
ccb78c9d | 40 | %{?with_milter:BuildRequires: libmilter-devel} |
e278889f | 41 | BuildRequires: zlib-devel |
dd6d36d5 ER |
42 | Requires(post,preun): /sbin/chkconfig |
43 | Requires(postun): /usr/sbin/groupdel | |
44 | Requires(postun): /usr/sbin/userdel | |
45 | Requires(postun,pre): /usr/sbin/usermod | |
0e86f481 | 46 | Requires(pre): /bin/id |
49797116 | 47 | Requires(pre): /usr/bin/getgid |
48 | Requires(pre): /usr/sbin/groupadd | |
49 | Requires(pre): /usr/sbin/useradd | |
d985d248 | 50 | Requires(triggerpostun): sed >= 4.0 |
d4117574 | 51 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} |
dd6d36d5 | 52 | Requires: /usr/sbin/usermod |
6a92e05d | 53 | Requires: bc |
0e86f481 | 54 | Requires: rc-scripts |
49797116 | 55 | Provides: group(clamav) |
56 | Provides: user(clamav) | |
e6c034d3 | 57 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
58 | ||
e6c034d3 | 59 | %description |
60 | Clam Antivirus is a powerful anti-virus scanner for Unix. It supports | |
ba45f729 | 61 | AMaViS, compressed files, on-access scanning and includes a program |
eba74cc1 | 62 | for auto-updating with support for digital signatures. The virus |
c8321415 | 63 | database has over 85387 viruses, worms and trojans signatures. The |
eba74cc1 | 64 | scanner is multithreaded, written in C, and POSIX compliant. |
e6c034d3 | 65 | |
d8cf2de3 JR |
66 | %description -l pl.UTF-8 |
67 | Clam Antivirus jest potężnym skanerem antywirusowym dla systemów | |
eba74cc1 | 68 | uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie |
69 | "on-access" i posiada system bezpiecznej, automatycznej aktualizacji. | |
d8cf2de3 | 70 | Baza wirusów zawiera ponad 85387 sygnatur. Skaner jest wielowątkowy, |
ba45f729 | 71 | napisany w C i zgodny z POSIXem. |
e6c034d3 | 72 | |
4460ff0b | 73 | %package libs |
f98d218a | 74 | Summary: Shared libraries for clamav |
d8cf2de3 | 75 | Summary(pl.UTF-8): Biblioteki dzielone clamav |
f98d218a | 76 | Group: Libraries |
4460ff0b AM |
77 | |
78 | %description libs | |
79 | Shared libraries for clamav. | |
80 | ||
d8cf2de3 | 81 | %description libs -l pl.UTF-8 |
4460ff0b AM |
82 | Biblioteki dzielone clamav. |
83 | ||
486b4f0f JB |
84 | %package milter |
85 | Summary: ClamAV filter using milter interface | |
d8cf2de3 | 86 | Summary(pl.UTF-8): Filtr ClamAV korzystający z interfejsu milter |
eba74cc1 | 87 | Group: Daemons |
d4117574 | 88 | Requires: %{name} = %{epoch}:%{version}-%{release} |
eba74cc1 | 89 | Requires: sendmail >= 8.11 |
90 | Requires: tcp_wrappers | |
eba74cc1 | 91 | |
92 | %description milter | |
93 | ClamAV sendmail filter using MILTER interface. | |
94 | ||
d8cf2de3 JR |
95 | %description milter -l pl.UTF-8 |
96 | Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER. | |
eba74cc1 | 97 | |
4460ff0b | 98 | %package devel |
f98d218a | 99 | Summary: clamav - Development header files and libraries |
d8cf2de3 | 100 | Summary(pl.UTF-8): clamav - Pliki nagłówkowe i biblioteki dla programistów |
f98d218a | 101 | Group: Development/Libraries |
d4117574 | 102 | Requires: %{name}-libs = %{epoch}:%{version}-%{release} |
cc776ef1 JB |
103 | Requires: bzip2-devel |
104 | Requires: gmp-devel | |
105 | Requires: zlib-devel | |
4460ff0b AM |
106 | |
107 | %description devel | |
108 | This package contains the development header files and libraries | |
109 | necessary to develop clamav client applications. | |
110 | ||
d8cf2de3 JR |
111 | %description devel -l pl.UTF-8 |
112 | Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji | |
142cc22a | 113 | klienckich clamav. |
4460ff0b AM |
114 | |
115 | %package static | |
dd6d36d5 | 116 | Summary: clamav static libraries |
d8cf2de3 | 117 | Summary(pl.UTF-8): Biblioteki statyczne clamav |
f98d218a | 118 | Group: Development/Libraries |
d4117574 | 119 | Requires: %{name}-devel = %{epoch}:%{version}-%{release} |
4460ff0b AM |
120 | |
121 | %description static | |
f33eb2df | 122 | clamav static libraries. |
4460ff0b | 123 | |
d8cf2de3 | 124 | %description static -l pl.UTF-8 |
4460ff0b AM |
125 | Biblioteki statyczne clamav. |
126 | ||
e6c034d3 | 127 | %prep |
c8321415 | 128 | %setup -q %{?_rc:-n %{name}-%{version}%{_rc}} |
c935072a | 129 | %patch0 -p1 |
83eaf0c7 | 130 | %patch1 -p1 |
82747f5b | 131 | %patch2 -p1 |
4ffd87a3 | 132 | %patch3 -p0 |
82747f5b JB |
133 | |
134 | # kill old libtool.m4 copy | |
135 | head -n 489 acinclude.m4 > acinclude.m4.tmp | |
b6fff77e | 136 | tail -n +4089 acinclude.m4 >> acinclude.m4.tmp |
82747f5b | 137 | mv -f acinclude.m4.tmp acinclude.m4 |
40d35cf5 | 138 | |
e6c034d3 | 139 | %build |
82747f5b | 140 | %{__libtoolize} |
4460ff0b | 141 | %{__aclocal} |
ed667a13 | 142 | %{__autoconf} |
82747f5b | 143 | %{__autoheader} |
ed667a13 | 144 | %{__automake} |
92c5ef39 | 145 | %configure \ |
ca57b115 | 146 | --disable-clamav \ |
7c471170 | 147 | %{!?with_curl:--without-libcurl} \ |
142cc22a | 148 | %{?with_milter:--enable-milter} \ |
ca57b115 | 149 | --with-dbdir=/var/lib/%{name} |
92c5ef39 | 150 | %{__make} |
4d3c9f35 | 151 | |
e6c034d3 | 152 | %install |
153 | rm -rf $RPM_BUILD_ROOT | |
06e3ab45 TP |
154 | install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \ |
155 | $RPM_BUILD_ROOT%{_var}/{log,spool/clamav} | |
92c5ef39 AM |
156 | |
157 | %{__make} install \ | |
158 | DESTDIR=$RPM_BUILD_ROOT | |
142cc22a | 159 | %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*} |
92c5ef39 | 160 | |
d78cc52a | 161 | cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name} |
719d471d | 162 | 5 * * * * root %{_sbindir}/clamav-cron-updatedb |
ca57b115 | 163 | EOF |
92c5ef39 | 164 | |
05eb87ef | 165 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd |
4381c9a3 | 166 | %if %{with milter} |
eba74cc1 | 167 | install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter |
eba74cc1 | 168 | install %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter |
4381c9a3 | 169 | %endif |
170 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd | |
719d471d | 171 | install %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb |
142cc22a | 172 | install etc/*.conf $RPM_BUILD_ROOT%{_sysconfdir} |
813b04f8 | 173 | install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} |
2b9f3e64 | 174 | |
3e84b306 | 175 | install %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir} |
4460ff0b | 176 | |
c935072a MK |
177 | # NOTE: clamd uses sane rights to it's clamd.pid file |
178 | # So better keep it dir | |
179 | # If it is fixed use of dir will be unecesary | |
d78cc52a | 180 | install -d $RPM_BUILD_ROOT/var/run/%{name} |
c935072a | 181 | |
d78cc52a | 182 | :> $RPM_BUILD_ROOT/var/log/freshclam.log |
ef21d0fa | 183 | |
e6c034d3 | 184 | %clean |
92c5ef39 | 185 | rm -rf $RPM_BUILD_ROOT |
e6c034d3 | 186 | |
c935072a MK |
187 | %triggerin -- amavis-ng |
188 | AMAVIS=$(/usr/bin/getgid amavis) | |
189 | RESULT=$? | |
1475e7a3 | 190 | if [ $RESULT -eq 0 ]; then |
236dddf1 | 191 | echo "Adding clamav to amavis group GID=$AMAVIS" |
06e3ab45 | 192 | /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null |
c935072a MK |
193 | fi |
194 | ||
195 | %triggerin -- amavisd-new | |
196 | AMAVIS=$(/usr/bin/getgid amavis) | |
197 | RESULT=$? | |
1475e7a3 | 198 | if [ $RESULT -eq 0 ]; then |
236dddf1 | 199 | echo "Adding clamav to amavis group GID=$AMAVIS" |
06e3ab45 | 200 | /usr/sbin/usermod -G amavis clamav 1>&2 > /dev/null |
c935072a MK |
201 | fi |
202 | ||
203 | %triggerin -- amavisd | |
204 | AMAVIS=$(/usr/bin/getgid amavis) | |
205 | RESULT=$? | |
1475e7a3 | 206 | if [ $RESULT -eq 0 ]; then |
236dddf1 | 207 | echo "Adding clamav to amavis group GID=$AMAVIS" |
49797116 | 208 | /usr/sbin/usermod -G amavis clamav 1>&2 |
c935072a MK |
209 | fi |
210 | ||
e278889f | 211 | %pre |
236dddf1 ER |
212 | %groupadd -g 43 clamav |
213 | %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav | |
214 | ||
215 | # FIXME: check this. is it proper after useradd macro? | |
216 | # TODO: use addusertogroup macro? | |
217 | if [ -n "`/usr/bin/getgid amavis`" ]; then | |
218 | echo "Adding clamav to amavis group" | |
219 | /usr/sbin/usermod -G amavis clamav 1>&2 | |
174915c1 | 220 | fi |
221 | ||
66d1575d | 222 | %post |
66d1575d | 223 | /sbin/chkconfig --add clamd |
dd6d36d5 | 224 | %service clamd restart "Clam Antivirus daemon" |
d78cc52a ER |
225 | touch /var/log/freshclam.log |
226 | chown clamav:root /var/log/freshclam.log | |
227 | chmod 640 /var/log/freshclam.log | |
66d1575d | 228 | |
66d1575d | 229 | %preun |
230 | if [ "$1" = "0" ]; then | |
dd6d36d5 | 231 | %service clamd stop |
66d1575d | 232 | /sbin/chkconfig --del clamd |
233 | fi | |
e6c034d3 | 234 | |
0c8c3ba4 | 235 | %postun |
174915c1 | 236 | if [ "$1" = "0" ]; then |
49797116 | 237 | %userremove clamav |
238 | %groupremove clamav | |
174915c1 | 239 | fi |
240 | ||
1eab800a | 241 | %triggerpostun -- %{name} <= 0.75.1 |
242 | if [ -f /etc/clamav.conf.rpmsave ]; then | |
d093ed8c | 243 | echo "Renaming config to new name /etc/clamd.conf" |
244 | mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew | |
245 | mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf | |
d4117574 | 246 | echo "Changing config location in freshclam config" |
f12ca2c1 ER |
247 | %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf |
248 | fi | |
249 | ||
29f80fd8 ER |
250 | %triggerpostun -- %{name} < 0.90-0.rc2.0.10 |
251 | %{__cp} -f /etc/clamd.conf{,.rpmsave} | |
252 | %{__sed} -i -e ' | |
253 | s,^LogSyslog$,& yes, | |
254 | s,^FixStaleSocket$,& yes, | |
255 | s,^AllowSupplementaryGroups$,& yes, | |
256 | s,^ClamukoScanOnOpen$,& yes, | |
257 | s,^ClamukoScanOnClose$,& yes, | |
258 | s,^ClamukoScanOnExec$,& yes, | |
259 | ' /etc/clamd.conf | |
260 | %banner -e %{name}-0.90 <<EOF | |
261 | ClamAV config was automatically upgraded to 0.90 format. You should review it | |
262 | that it's still valid. | |
263 | EOF | |
264 | #' | |
265 | # unfortunately clamd has no configcheck option so we just have to start it | |
266 | # once again after config was broken after upgrade | |
267 | touch /var/lock/subsys/clamd | |
268 | %service -q clamd restart | |
1eab800a | 269 | |
eba74cc1 | 270 | %post milter |
271 | /sbin/chkconfig --add clamav-milter | |
dd6d36d5 | 272 | %service clamav-milter restart "Clam Antivirus daemon" |
eba74cc1 | 273 | |
4c570814 | 274 | %preun milter |
eba74cc1 | 275 | if [ "$1" = "0" ]; then |
dd6d36d5 | 276 | %service clamav-milter stop |
eba74cc1 | 277 | /sbin/chkconfig --del clamav-milter |
278 | fi | |
fba342ab | 279 | |
1475e7a3 | 280 | %post libs -p /sbin/ldconfig |
281 | %postun libs -p /sbin/ldconfig | |
4460ff0b | 282 | |
e6c034d3 | 283 | %files |
284 | %defattr(644,root,root,755) | |
6490b0f8 | 285 | %doc AUTHORS ChangeLog FAQ NEWS README TODO docs/*.pdf |
24f68046 | 286 | %attr(755,root,root) %{_bindir}/clamdscan |
287 | %attr(755,root,root) %{_bindir}/clamscan | |
288 | %attr(755,root,root) %{_bindir}/freshclam | |
289 | %attr(755,root,root) %{_bindir}/sigtool | |
d78cc52a | 290 | %attr(755,root,root) %{_bindir}/clamconf |
24f68046 | 291 | %attr(755,root,root) %{_sbindir}/clamd |
292 | %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb | |
c8321415 | 293 | %attr(755,root,root) %{_sbindir}/clamav-post-updatedb |
ca57b115 | 294 | %attr(755,clamav,root) %dir /var/lib/%{name} |
c8321415 | 295 | %ghost %attr(644,clamav,root) %verify(not md5 mtime size) /var/lib/clamav/*.cvd |
d78cc52a ER |
296 | %attr(640,clamav,root) %ghost /var/log/freshclam.log |
297 | %attr(750,clamav,clamav) %dir /var/run/%{name} | |
c935072a | 298 | |
b5177881 | 299 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name} |
0e86f481 JB |
300 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf |
301 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf | |
6586d93d | 302 | |
05eb87ef | 303 | %attr(754,root,root) /etc/rc.d/init.d/clamd |
7c801993 ER |
304 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd |
305 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav | |
eba74cc1 | 306 | %{_mandir}/man[15]/* |
307 | %{_mandir}/man8/clamd* | |
308 | ||
309 | %if %{with milter} | |
310 | %files milter | |
311 | %defattr(644,root,root,755) | |
7c801993 | 312 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter |
491eb046 | 313 | %attr(754,root,root) /etc/rc.d/init.d/clamav-milter |
eba74cc1 | 314 | #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter |
315 | #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter | |
316 | #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf | |
317 | %attr(755,root,root) %{_sbindir}/clamav-milter | |
318 | %{_mandir}/man8/clamav-milter.8* | |
0e86f481 | 319 | %attr(700,clamav,clamav) /var/spool/clamav |
eba74cc1 | 320 | %endif |
4460ff0b AM |
321 | |
322 | %files libs | |
323 | %defattr(644,root,root,755) | |
263ab0bb | 324 | %attr(755,root,root) %{_libdir}/lib*.so.*.* |
4460ff0b AM |
325 | |
326 | %files devel | |
327 | %defattr(644,root,root,755) | |
24f68046 | 328 | %attr(755,root,root) %{_bindir}/clamav-config |
4460ff0b | 329 | %attr(755,root,root) %{_libdir}/lib*.so |
52d00604 | 330 | %{_libdir}/lib*.la |
4460ff0b | 331 | %{_includedir}/*.h |
0d90572a | 332 | %{_pkgconfigdir}/*.pc |
4460ff0b AM |
333 | |
334 | %files static | |
335 | %defattr(644,root,root,755) | |
336 | %{_libdir}/*.a |