You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

185 lines
6.6 KiB

##
## amavisd.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_major 20030616
%define V_minor p7
# package information
Name: amavisd
Summary: Interface Daemon between MTA and Content Checker
URL: http://www.ijs.si/software/amavisd/
Vendor: Mark Martinec
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: EVAL
Group: Mail
License: GPL
Version: %{V_major}%{V_minor}
Release: 20040203
# package options
%option with_milter no
# list of sources
Source0: http://www.ijs.si/software/amavisd/amavisd-new-%{V_major}-%{V_minor}.tar.gz
Source1: rc.amavisd
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, sed
PreReq: OpenPKG, openpkg >= 20040130, spamassassin
PreReq: perl, perl-net, perl-util, perl-mail, perl-time
PreReq: perl-sys, perl-comp, perl-conv
%if "%{with_milter}" == "yes"
BuildPreReq: sendmail, sendmail::with_milter = yes
PreReq: sendmail, sendmail::with_milter = yes
%endif
AutoReq: no
AutoReqProv: no
%description
amavisd-new is a high-performance interface between mailer (MTA) and
content checkers: virus scanners, and/or SpamAssassin. It is written
in Perl for maintainability, without paying a significant price
for speed. It talks to MTA via (E)SMTP or LMTP, or by using helper
programs. Best with Postfix, works with Exim, sendmail/milter, or
with any MTA as a SMTP relay.
%track
prog amavisd = {
version = 20030616-p7
url = http://www.ijs.si/software/amavisd/
regex = amavisd-new-(__VER__)\.tar\.gz
}
%prep
%setup -q -n amavisd-new-%{V_major}
%{l_shtool} subst \
-e "s;'clamscan';%{l_prefix}/bin/clamscan;g" \
-e "s;'uvscan';%{l_prefix}/bin/uvscan;g" \
-e 's;/var/amavis/clamd;%{l_prefix}/var/clamav/clamd.sock;g' \
-e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
-e 's;/var/virusmails;%{l_prefix}/var/amavisd/virusmails;g' \
-e 's;/usr/bin/sendmail;%{l_prefix}/sbin/sendmail;g' \
-e 's; -C/etc/sendmail.orig.cf ;;g' \
-e 's;/usr/bin/exim;%{l_prefix}/bin/exim;g' \
-e 's;/usr/local/sbin;%{l_prefix}/sbin;g' \
-e 's;/usr/local/bin;%{l_prefix}/bin;g' \
-e 's;\(daemon_user *= \)[^;]*;\1q{%{l_rusr}};' \
-e 's;\(daemon_group *= \)[^;]*;\1q{%{l_rgrp}};' \
-e 's;\(\$DO_SYSLOG *= \)[^;]*;\10;' \
-e 's;\(\$LOGFILE *=.*\)amavis.log\([^ \t]*\) \(.*\);\1amavisd.log\2\3;' \
-e 's;\(\$path *=.*\)/usr/local/sbin\(.*\);\1%{l_prefix}/sbin:%{l_prefix}/bin:/usr/local/sbin\2;' \
amavisd.conf
%{l_shtool} subst \
-e '1s;/usr/bin/perl;%{l_prefix}/bin/perl;' \
-e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
-e 's;/etc/amavisd.conf;%{l_prefix}/etc/amavisd/amavisd.conf;g' \
amavisd
%build
%if "%{with_milter}" == "yes"
cd helper-progs
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="%{l_ldflags}" \
./configure
--prefix="%{l_prefix}" \
--with-sendmail="%{l_prefix}/sbin/sendmail" \
--with-runtime-dir="%{l_prefix}/var/amavisd" \
--with-sockname="%{l_prefix}/var/amavisd/amavisd.sock" \
--with-user="@l_rusr@" \
--with-milterinc="%{l_prefix}/include/libmilter" \
--with-milterlib="%{l_prefix}/lib"
%endif
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/amavisd \
$RPM_BUILD_ROOT%{l_prefix}/etc/amavisd/test-messages \
$RPM_BUILD_ROOT%{l_prefix}/share/amavisd/README_FILES \
$RPM_BUILD_ROOT%{l_prefix}/var/amavisd \
$RPM_BUILD_ROOT%{l_prefix}/var/amavisd/virusmails
%{l_shtool} install -c -m 755 \
amavisd \
$RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 \
amavisd.conf \
$RPM_BUILD_ROOT%{l_prefix}/etc/amavisd/
%{l_shtool} install -c -m 644 \
test-messages/* \
$RPM_BUILD_ROOT%{l_prefix}/etc/amavisd/test-messages/
%{l_shtool} install -c -m 644 \
README_FILES/* \
$RPM_BUILD_ROOT%{l_prefix}/share/amavisd/README_FILES/
%{l_shtool} install -c -m 644 \
RELEASE_NOTES \
$RPM_BUILD_ROOT%{l_prefix}/share/amavisd/
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.amavisd} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
'%config %{l_prefix}/etc/amavisd/amavisd.conf' \
'%attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/amavisd' \
'%attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/amavisd/virusmails'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%pre
# before upgrade, save status and stop service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} amavisd status 2>/dev/null | tee %{l_tmpfile}`
%{l_rc} amavisd stop 2>/dev/null
exit 0
%post
if [ $1 -eq 2 ]; then
# after upgrade, restore status
eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
[ ".$amavisd_active" = .yes ] && %{l_rc} amavisd start
fi
exit 0
%preun
# before erase, stop service
[ $1 -eq 0 ] || exit 0
%{l_rc} amavisd stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/amavisd/*.log* >/dev/null 2>&1 || true
exit 0