1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/clamav/clamav.spec Sun Nov 01 15:42:37 2009 +0100 1.3 @@ -0,0 +1,190 @@ 1.4 +## 1.5 +## clamav.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: clamav 1.29 +Summary: Clam Antivirus 1.30 +URL: http://www.clamav.net/ 1.31 +Vendor: Tomasz Kojm 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: EVAL 1.35 +Group: AntiVirus 1.36 +License: GPL 1.37 +Version: 0.95.2 1.38 +Release: 20090702 1.39 + 1.40 +# package options 1.41 +%option with_milter no 1.42 + 1.43 +# list of sources 1.44 +Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz 1.45 +Source1: rc.clamav 1.46 +Patch0: clamav.patch 1.47 + 1.48 +# build information 1.49 +Prefix: %{l_prefix} 1.50 +BuildRoot: %{l_buildroot} 1.51 +BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, bzip2, pkgconfig, bc 1.52 +PreReq: OpenPKG, openpkg >= 20060823 1.53 +BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl 1.54 +PreReq: zlib, bzip2, curl, gmp, libiconv, openssl 1.55 +%if "%{with_milter}" == "yes" 1.56 +BuildPreReq: milter 1.57 +PreReq: milter 1.58 +%endif 1.59 +AutoReq: no 1.60 +AutoReqProv: no 1.61 + 1.62 +%description 1.63 + Clam AntiVirus is an anti-virus toolkit for UNIX. The main 1.64 + purpose of this software is the integration with mail servers 1.65 + (attachment scanning). The package provides a flexible and scalable 1.66 + multi-threaded daemon, a command line scanner, and a tool for 1.67 + automatic updating via Internet. The programs are based on a shared 1.68 + library distributed with the Clam AntiVirus package, which you can 1.69 + use with your own software. The virus database is based on the virus 1.70 + database from OpenAntiVirus, but contains additional signatures. 1.71 + 1.72 +%track 1.73 + prog clamav = { 1.74 + version = %{version} 1.75 + url = http://sourceforge.net/projects/clamav/files/ 1.76 + regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz 1.77 + } 1.78 + 1.79 +%prep 1.80 + %setup -q 1.81 + %patch -p0 1.82 + 1.83 +%build 1.84 + # configure package 1.85 + CC="%{l_cc}" \ 1.86 + CFLAGS="%{l_cflags -O}" \ 1.87 + CPPFLAGS="%{l_cppflags}" \ 1.88 + LDFLAGS="%{l_ldflags}" \ 1.89 + GREP="grep" \ 1.90 + ./configure \ 1.91 + --prefix=%{l_prefix} \ 1.92 + --mandir=%{l_prefix}/man \ 1.93 + --sysconfdir=%{l_prefix}/etc/clamav \ 1.94 + --with-zlib=%{l_prefix} \ 1.95 + --with-libcurl \ 1.96 + --with-user=%{l_rusr} \ 1.97 + --with-group=%{l_rgrp} \ 1.98 + --without-tcpwrappers \ 1.99 + --disable-clamav \ 1.100 + --disable-clamuko \ 1.101 + --disable-urandom \ 1.102 + --disable-cr \ 1.103 +%if "%{with_milter}" == "yes" 1.104 + --enable-milter \ 1.105 + --with-sendmail=/dev/null \ 1.106 +%else 1.107 + --disable-milter \ 1.108 +%endif 1.109 + --disable-unrar \ 1.110 + --disable-shared 1.111 + 1.112 + # build package 1.113 + %{l_make} %{l_mflags -O} 1.114 + 1.115 +%install 1.116 + rm -rf $RPM_BUILD_ROOT 1.117 + 1.118 + # perform standard package installation 1.119 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.120 + 1.121 + # install default configuration 1.122 + %{l_shtool} mkdir -f -p -m 755 \ 1.123 + $RPM_BUILD_ROOT%{l_prefix}/etc/clamav 1.124 + %{l_shtool} install -c -m 644 \ 1.125 + -e 's;^\(Example\);#\1;' \ 1.126 + -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \ 1.127 + -e 's;^#\(LogTime.*\);\1;' \ 1.128 + -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \ 1.129 + -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \ 1.130 + -e 's;^#\(FixStaleSocket.*\);\1;' \ 1.131 + -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \ 1.132 + -e 's;^#\(User\).*;\1 %{l_rusr};' \ 1.133 + etc/clamd.conf \ 1.134 + $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/ 1.135 + %{l_shtool} install -c -m 644 \ 1.136 + -e 's;^\(Example\);#\1;' \ 1.137 + -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \ 1.138 + -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \ 1.139 + -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \ 1.140 + etc/freshclam.conf \ 1.141 + $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/ 1.142 + 1.143 + # install run-command script 1.144 + %{l_shtool} mkdir -f -p -m 755 \ 1.145 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.146 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.147 + %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.148 + 1.149 + # strip-down installation hierarchy 1.150 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true 1.151 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.152 +%if "%{with_milter}" == "no" 1.153 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8 1.154 +%endif 1.155 + 1.156 + # create additional installation directory 1.157 + %{l_shtool} mkdir -f -p -m 755 \ 1.158 + $RPM_BUILD_ROOT%{l_prefix}/var/clamav 1.159 + 1.160 + # determine installation files 1.161 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.162 + %{l_files_std} \ 1.163 + '%config %{l_prefix}/etc/clamav/*.conf' \ 1.164 + '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \ 1.165 + '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/clamav' 1.166 + 1.167 +%files -f files 1.168 + 1.169 +%clean 1.170 + rm -rf $RPM_BUILD_ROOT 1.171 + 1.172 +%pre 1.173 + # before upgrade, save status and stop service 1.174 + [ $1 -eq 2 ] || exit 0 1.175 + eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}` 1.176 + %{l_rc} clamav stop 2>/dev/null 1.177 + exit 0 1.178 + 1.179 +%post 1.180 + if [ $1 -eq 2 ]; then 1.181 + # after upgrade, restore status 1.182 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.183 + [ ".$clamav_active" = .yes ] && %{l_rc} clamav start 1.184 + fi 1.185 + exit 0 1.186 + 1.187 +%preun 1.188 + # before erase, stop service and remove log files 1.189 + [ $1 -eq 0 ] || exit 0 1.190 + %{l_rc} clamav stop 2>/dev/null 1.191 + rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true 1.192 + exit 0 1.193 +