Fri, 03 Aug 2012 15:56:30 +0200
Use upstream man pages to avoid local help2man failures, likely due to
shell capability assumptions or cross platform environment variance.
The upstream man pages are probably better formatted anyway.
1 ##
2 ## clamav.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # MSvB FIXME:
25 # MSvB FIXME: Problem with logging to syslog instead of FSL...
26 # MSvB FIXME:
27 # MSvB FIXME: Oct 2 10:15:47 host.name.tld clamav-milter[25958]: [ID 909925 user.error] ClamAV: thread_create() failed: 11, try again
28 # MSvB FIXME: Oct 2 10:17:28 host.name.tld last message repeated 1 time
29 # MSvB FIXME:
31 # package information
32 Name: clamav
33 Summary: Clam Antivirus
34 URL: http://www.clamav.net/
35 Vendor: Tomasz Kojm
36 Packager: OpenPKG Foundation e.V.
37 Distribution: OpenPKG Community
38 Class: EVAL
39 Group: AntiVirus
40 License: GPL
41 Version: 0.95.3
42 Release: 20091102
44 # package options
45 %option with_milter no
47 # list of sources
48 Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
49 Source1: rc.clamav
50 Patch0: clamav.patch
52 # build information
53 Prefix: %{l_prefix}
54 BuildRoot: %{l_buildroot}
55 BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, bzip2, pkgconfig, bc
56 PreReq: OpenPKG, openpkg >= 20060823
57 BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl
58 PreReq: zlib, bzip2, curl, gmp, libiconv, openssl
59 %if "%{with_milter}" == "yes"
60 BuildPreReq: milter
61 PreReq: milter
62 %endif
63 AutoReq: no
64 AutoReqProv: no
66 %description
67 Clam AntiVirus is an anti-virus toolkit for UNIX. The main
68 purpose of this software is the integration with mail servers
69 (attachment scanning). The package provides a flexible and scalable
70 multi-threaded daemon, a command line scanner, and a tool for
71 automatic updating via Internet. The programs are based on a shared
72 library distributed with the Clam AntiVirus package, which you can
73 use with your own software. The virus database is based on the virus
74 database from OpenAntiVirus, but contains additional signatures.
76 %track
77 prog clamav = {
78 version = %{version}
79 url = http://sourceforge.net/projects/clamav/files/
80 regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz
81 }
83 %prep
84 %setup -q
85 %patch -p0
87 %build
88 # configure package
89 CC="%{l_cc}" \
90 CFLAGS="%{l_cflags -O}" \
91 CPPFLAGS="%{l_cppflags}" \
92 LDFLAGS="%{l_ldflags}" \
93 GREP="grep" \
94 ./configure \
95 --prefix=%{l_prefix} \
96 --mandir=%{l_prefix}/man \
97 --sysconfdir=%{l_prefix}/etc/clamav \
98 --with-zlib=%{l_prefix} \
99 --with-libcurl \
100 --with-user=%{l_rusr} \
101 --with-group=%{l_rgrp} \
102 --without-tcpwrappers \
103 --disable-clamav \
104 --disable-clamuko \
105 --disable-urandom \
106 --disable-cr \
107 %if "%{with_milter}" == "yes"
108 --enable-milter \
109 --with-sendmail=/dev/null \
110 %else
111 --disable-milter \
112 %endif
113 --disable-unrar \
114 --disable-shared
116 # build package
117 %{l_make} %{l_mflags -O}
119 %install
120 rm -rf $RPM_BUILD_ROOT
122 # perform standard package installation
123 %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
125 # install default configuration
126 %{l_shtool} mkdir -f -p -m 755 \
127 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
128 %{l_shtool} install -c -m 644 \
129 -e 's;^\(Example\);#\1;' \
130 -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
131 -e 's;^#\(LogTime.*\);\1;' \
132 -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
133 -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
134 -e 's;^#\(FixStaleSocket.*\);\1;' \
135 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
136 -e 's;^#\(User\).*;\1 %{l_rusr};' \
137 etc/clamd.conf \
138 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
139 %{l_shtool} install -c -m 644 \
140 -e 's;^\(Example\);#\1;' \
141 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
142 -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
143 -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \
144 etc/freshclam.conf \
145 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
147 # install run-command script
148 %{l_shtool} mkdir -f -p -m 755 \
149 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
150 %{l_shtool} install -c -m 755 %{l_value -s -a} \
151 %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
153 # strip-down installation hierarchy
154 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
155 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
156 %if "%{with_milter}" == "no"
157 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
158 %endif
160 # create additional installation directory
161 %{l_shtool} mkdir -f -p -m 755 \
162 $RPM_BUILD_ROOT%{l_prefix}/var/clamav
164 # determine installation files
165 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
166 %{l_files_std} \
167 '%config %{l_prefix}/etc/clamav/*.conf' \
168 '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \
169 '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/clamav'
171 %files -f files
173 %clean
174 rm -rf $RPM_BUILD_ROOT
176 %pre
177 # before upgrade, save status and stop service
178 [ $1 -eq 2 ] || exit 0
179 eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
180 %{l_rc} clamav stop 2>/dev/null
181 exit 0
183 %post
184 if [ $1 -eq 2 ]; then
185 # after upgrade, restore status
186 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
187 [ ".$clamav_active" = .yes ] && %{l_rc} clamav start
188 fi
189 exit 0
191 %preun
192 # before erase, stop service and remove log files
193 [ $1 -eq 0 ] || exit 0
194 %{l_rc} clamav stop 2>/dev/null
195 rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
196 exit 0