##
## postgrey.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project
## Copyright (c) 2000-2004 Ralf S. Engelschall
## Copyright (c) 2000-2004 Cable & Wireless
##
## 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 information
Name: postgrey
Summary: Postfix Greylisting Daemon
URL: http://isg.ee.ethz.ch/tools/postgrey/
Vendor: David Schweikert
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: PLUS
Group: Mail
License: GPL
Version: 1.16
Release: 20041209
# list of sources
Source0: http://isg.ee.ethz.ch/tools/postgrey/pub/postgrey-%{version}.tar.gz
Source1: rc.postgrey
Source2: whitelist.clients
Source3: whitelist.recipients
Patch0: postgrey.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130
PreReq: OpenPKG, openpkg >= 20040130
BuildPreReq: perl
PreReq: perl, perl-sys, perl-net, perl-db, perl-dns
AutoReq: no
AutoReqProv: no
%description
Postgrey is a Postfix MTA policy server implementing Greylisting.
Related to whitelists and blacklists, a greylist indicates those
emails (originating from unknown IPs) which are rejected with a
"try again later" message. The email in question will be delayed
until the sending MTA tries again, but this is where spam loses
out. Most spam is not sent out using RFC compliant MTAs, and so
the spamming software will not "try again later".
%track
prog postgrey = {
version = %{version}
url = http://isg.ee.ethz.ch/tools/postgrey/pub/
regex = postgrey-(__VER__)\.tar\.gz
}
%prep
%setup -q
%patch -p0
%build
# build manual page
pod2man postgrey >postgrey.8
pod2man contrib/postgreyreport >contrib/postgreyreport.8
%install
# create installation hierarchy
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/man/man8 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/postgrey \
$RPM_BUILD_ROOT%{l_prefix}/var/postgrey
# install programs and manual pages
%{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
-e "s;\\(.\\)Sys::Syslog\\(. : undef\\);\\1%{l_prefix}/var/postgrey/postgrey.log\\2;" \
postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
-e 's;/var/spool/postfix/postgrey;%{l_prefix}/var/postgrey;' \
-e 's;\(=> .\)postgrey\(.\);\1%{l_rusr}\2;' \
contrib/postgreyreport $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 \
postgrey.8 contrib/postgreyreport.8 \
$RPM_BUILD_ROOT%{l_prefix}/man/man8/
# install configuration files
%{l_shtool} install -c -m 644 \
%{SOURCE whitelist.clients} \
%{SOURCE whitelist.recipients} \
$RPM_BUILD_ROOT%{l_prefix}/etc/postgrey/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.postgrey} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/postgrey/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/postgrey'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} postgrey status 2>/dev/null`
[ ".$postgrey_active" = .yes ] && %{l_rc} postgrey restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} postgrey stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/postgrey/*
exit 0