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