clamav/clamav.spec

Tue, 28 Aug 2012 18:36:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:35 +0200
changeset 579
6b18bb69901e
parent 393
9bafbc9da865
child 674
dd46abb0afa8
permissions
-rw-r--r--

Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.

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

mercurial