Sun, 02 Sep 2012 18:15:09 +0200
Remove unhelpful comment and attempt to correct config file protection.
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.97.5
42 Release: 20120800
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 BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, bzip2, pkgconfig, bc
54 PreReq: OpenPKG, openpkg >= 20100101
55 BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl
56 PreReq: zlib, bzip2, curl, gmp, libiconv, openssl
57 %if "%{with_milter}" == "yes"
58 BuildPreReq: milter
59 PreReq: milter
60 %endif
62 %description
63 Clam AntiVirus is an anti-virus toolkit for UNIX. The main
64 purpose of this software is the integration with mail servers
65 (attachment scanning). The package provides a flexible and scalable
66 multi-threaded daemon, a command line scanner, and a tool for
67 automatic updating via Internet. The programs are based on a shared
68 library distributed with the Clam AntiVirus package, which you can
69 use with your own software. The virus database is based on the virus
70 database from OpenAntiVirus, but contains additional signatures.
72 %track
73 prog clamav = {
74 version = %{version}
75 url = http://sourceforge.net/projects/clamav/files/
76 regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz
77 }
79 %prep
80 %setup -q
81 %patch -p0
82 %{l_shtool} subst \
83 -e 's;lib\(milter/mfapi.h\);\1;' \
84 configure
86 %build
87 # configure package
88 CC="%{l_cc}" \
89 CFLAGS="%{l_cflags -O}" \
90 CPPFLAGS="%{l_cppflags}" \
91 LDFLAGS="%{l_ldflags}" \
92 GREP="grep" \
93 ./configure \
94 --prefix=%{l_prefix} \
95 --libdir=%{l_prefix}/lib \
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 # perform standard package installation
121 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
123 # install default configuration
124 %{l_shtool} mkdir -f -p -m 755 \
125 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
126 %{l_shtool} install -c -m 644 \
127 -e 's;^\(Example\);#\1;' \
128 -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
129 -e 's;^#\(LogTime.*\);\1;' \
130 -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
131 -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
132 -e 's;^#\(FixStaleSocket.*\);\1;' \
133 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
134 -e 's;^#\(User\).*;\1 %{l_rusr};' \
135 etc/clamd.conf \
136 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
137 %{l_shtool} install -c -m 644 \
138 -e 's;^\(Example\);#\1;' \
139 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
140 -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
141 -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \
142 etc/freshclam.conf \
143 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
145 # install run-command script
146 %{l_shtool} mkdir -f -p -m 755 \
147 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
148 %{l_shtool} install -c -m 755 %{l_value -s -a} \
149 %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
151 # strip-down installation hierarchy
152 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
153 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
154 %if "%{with_milter}" == "no"
155 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
156 %endif
158 # create additional installation directory
159 %{l_shtool} mkdir -f -p -m 755 \
160 $RPM_BUILD_ROOT%{l_prefix}/var/clamav
162 # determine installation files
163 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
164 %{l_files_std} \
165 '%config %{l_prefix}/etc/clamav/*.conf' \
166 '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav'
168 %files -f files
170 %clean
172 %pre
173 # before upgrade, save status and stop service
174 [ $1 -eq 2 ] || exit 0
175 eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
176 %{l_rc} clamav stop 2>/dev/null
177 exit 0
179 %post
180 if [ $1 -eq 2 ]; then
181 # after upgrade, restore status
182 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
183 [ ".$clamav_active" = .yes ] && %{l_rc} clamav start
184 fi
185 exit 0
187 %preun
188 # before erase, stop service and remove log files
189 [ $1 -eq 0 ] || exit 0
190 %{l_rc} clamav stop 2>/dev/null
191 rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
192 exit 0