michael@226: ## michael@226: ## clamav.spec -- OpenPKG RPM Package Specification michael@226: ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. michael@226: ## michael@226: ## Permission to use, copy, modify, and distribute this software for michael@226: ## any purpose with or without fee is hereby granted, provided that michael@226: ## the above copyright notice and this permission notice appear in all michael@226: ## copies. michael@226: ## michael@226: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@226: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@226: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@226: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@226: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@226: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@226: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@226: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@226: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@226: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@226: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@226: ## SUCH DAMAGE. michael@226: ## michael@226: michael@393: # MSvB FIXME: michael@393: # MSvB FIXME: Problem with logging to syslog instead of FSL... michael@393: # MSvB FIXME: michael@393: # 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: # MSvB FIXME: Oct 2 10:17:28 host.name.tld last message repeated 1 time michael@393: # MSvB FIXME: michael@393: michael@226: # package information michael@226: Name: clamav michael@226: Summary: Clam Antivirus michael@226: URL: http://www.clamav.net/ michael@226: Vendor: Tomasz Kojm michael@226: Packager: OpenPKG Foundation e.V. michael@226: Distribution: OpenPKG Community michael@226: Class: EVAL michael@226: Group: AntiVirus michael@226: License: GPL michael@498: Version: 0.97.5 michael@498: Release: 20120800 michael@226: michael@226: # package options michael@226: %option with_milter no michael@226: michael@226: # list of sources michael@226: Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz michael@226: Source1: rc.clamav michael@226: Patch0: clamav.patch michael@226: michael@226: # build information michael@498: BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, bzip2, pkgconfig, bc michael@498: PreReq: OpenPKG, openpkg >= 20100101 michael@226: BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl michael@226: PreReq: zlib, bzip2, curl, gmp, libiconv, openssl michael@226: %if "%{with_milter}" == "yes" michael@226: BuildPreReq: milter michael@226: PreReq: milter michael@226: %endif michael@226: michael@226: %description michael@226: Clam AntiVirus is an anti-virus toolkit for UNIX. The main michael@226: purpose of this software is the integration with mail servers michael@226: (attachment scanning). The package provides a flexible and scalable michael@226: multi-threaded daemon, a command line scanner, and a tool for michael@226: automatic updating via Internet. The programs are based on a shared michael@226: library distributed with the Clam AntiVirus package, which you can michael@226: use with your own software. The virus database is based on the virus michael@226: database from OpenAntiVirus, but contains additional signatures. michael@226: michael@226: %track michael@226: prog clamav = { michael@226: version = %{version} michael@226: url = http://sourceforge.net/projects/clamav/files/ michael@226: regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz michael@226: } michael@226: michael@226: %prep michael@226: %setup -q michael@226: %patch -p0 michael@498: %{l_shtool} subst \ michael@498: -e 's;lib\(milter/mfapi.h\);\1;' \ michael@498: configure michael@674: %{l_shtool} subst \ michael@674: -e 's;test -s *\(.*\) *-a -s;test -e \1 -a -e;' \ michael@674: database/Makefile.in michael@226: michael@226: %build michael@226: # configure package michael@226: CC="%{l_cc}" \ michael@226: CFLAGS="%{l_cflags -O}" \ michael@226: CPPFLAGS="%{l_cppflags}" \ michael@226: LDFLAGS="%{l_ldflags}" \ michael@226: GREP="grep" \ michael@226: ./configure \ michael@226: --prefix=%{l_prefix} \ michael@498: --libdir=%{l_prefix}/lib \ michael@226: --mandir=%{l_prefix}/man \ michael@226: --sysconfdir=%{l_prefix}/etc/clamav \ michael@226: --with-zlib=%{l_prefix} \ michael@226: --with-libcurl \ michael@226: --with-user=%{l_rusr} \ michael@226: --with-group=%{l_rgrp} \ michael@226: --without-tcpwrappers \ michael@226: --disable-clamav \ michael@226: --disable-clamuko \ michael@226: --disable-urandom \ michael@226: --disable-cr \ michael@226: %if "%{with_milter}" == "yes" michael@226: --enable-milter \ michael@226: --with-sendmail=/dev/null \ michael@226: %else michael@226: --disable-milter \ michael@226: %endif michael@226: --disable-unrar \ michael@226: --disable-shared michael@226: michael@226: # build package michael@226: %{l_make} %{l_mflags -O} michael@226: michael@226: %install michael@226: # perform standard package installation michael@498: %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT" michael@226: michael@226: # install default configuration michael@226: %{l_shtool} mkdir -f -p -m 755 \ michael@226: $RPM_BUILD_ROOT%{l_prefix}/etc/clamav michael@226: %{l_shtool} install -c -m 644 \ michael@226: -e 's;^\(Example\);#\1;' \ michael@226: -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \ michael@226: -e 's;^#\(LogTime.*\);\1;' \ michael@226: -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \ michael@226: -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \ michael@226: -e 's;^#\(FixStaleSocket.*\);\1;' \ michael@226: -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \ michael@226: -e 's;^#\(User\).*;\1 %{l_rusr};' \ michael@226: etc/clamd.conf \ michael@226: $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/ michael@226: %{l_shtool} install -c -m 644 \ michael@226: -e 's;^\(Example\);#\1;' \ michael@226: -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \ michael@226: -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \ michael@226: -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \ michael@226: etc/freshclam.conf \ michael@226: $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/ michael@226: michael@226: # install run-command script michael@226: %{l_shtool} mkdir -f -p -m 755 \ michael@226: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@226: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@226: %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@226: michael@226: # strip-down installation hierarchy michael@226: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true michael@226: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true michael@226: %if "%{with_milter}" == "no" michael@226: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8 michael@226: %endif michael@226: michael@226: # create additional installation directory michael@226: %{l_shtool} mkdir -f -p -m 755 \ michael@226: $RPM_BUILD_ROOT%{l_prefix}/var/clamav michael@226: michael@226: # determine installation files michael@226: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@226: %{l_files_std} \ michael@226: '%config %{l_prefix}/etc/clamav/*.conf' \ michael@674: '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \ michael@674: '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/share/clamav' michael@226: michael@226: %files -f files michael@226: michael@226: %clean michael@226: michael@226: %pre michael@226: # before upgrade, save status and stop service michael@226: [ $1 -eq 2 ] || exit 0 michael@226: eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}` michael@226: %{l_rc} clamav stop 2>/dev/null michael@226: exit 0 michael@226: michael@226: %post michael@226: if [ $1 -eq 2 ]; then michael@226: # after upgrade, restore status michael@226: eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} michael@226: [ ".$clamav_active" = .yes ] && %{l_rc} clamav start michael@226: fi michael@226: exit 0 michael@226: michael@226: %preun michael@226: # before erase, stop service and remove log files michael@226: [ $1 -eq 0 ] || exit 0 michael@226: %{l_rc} clamav stop 2>/dev/null michael@226: rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true michael@226: exit 0 michael@226: