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