File postgrey.spec of Package postgrey

Summary: 	Postfix Greylisting Policy Server
Name:		postgrey
Version: 	1.31
Release:	1
License: 	GPL
Group: 		System/Servers
Source1:	%{name}.init
Source2:	%{name}.sysconfig
Source3:	%{name}.README.SuSE
Patch0:		postgrey-user.patch
Buildarch:	noarch
BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-buildroot/
Requires:	perl-Net-Server, perl-BerkeleyDB, perl-IO-Multiplex
BuildRequires:	perl, coreutils

%define confdir 	/etc/postfix
%define queue_directory %{_var}/spool/postfix

Postgrey is a Postfix policy server implementing greylisting.
When a request for delivery of a mail is received by Postfix 
via SMTP, the triplet CLIENT_IP / SENDER / RECIPIENT is built. 
If it is the first time that this triplet is seen, or if the 
triplet was first seen less than 5 minutes, then the mail gets 
rejected with a temporary error. Hopefully spammers or viruses 
will not try again later, as it is however required per RFC.

%setup -q -n %{name}-%{version}

%patch0 -p1

pod2man -s 8 -c "" postgrey > postgrey.8
pod2man -s 8 -c "" contrib/postgreyreport > contrib/postgreyreport.8

rm -rf %{buildroot}

mkdir -p %{buildroot}%{_initrddir}
install %{SOURCE1} %{buildroot}%{_initrddir}/%{name}

mkdir -p %{buildroot}%{_sysconfdir}/postfix
cp postgrey_whitelist_clients %{buildroot}%{_sysconfdir}/postfix
cp postgrey_whitelist_recipients %{buildroot}%{_sysconfdir}/postfix
touch %{buildroot}%{_sysconfdir}/postfix/postgrey_whitelist_clients.local

mkdir -p %{buildroot}%{_sbindir}
install postgrey %{buildroot}%{_sbindir}/postgrey
install contrib/postgreyreport %{buildroot}%{_sbindir}/postgreyreport

# Need to SuSEize
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
cp -p %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}

# create rc script link
ln -sf %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}

# Use this dir for db path since it's the default in postgreyreport
mkdir -p %{buildroot}%{queue_directory}/%{name}

mkdir -p %{buildroot}%{_mandir}/man8
cp postgrey.8 contrib/postgreyreport.8 %{buildroot}%{_mandir}/man8


rm -rf %{buildroot}

#%_pre_useradd %{name} %{_localstatedir}/%{name} /bin/false

#%_post_service %{name}

#%_preun_service %{name}

#%_postun_userdel %{name}

%attr(755, root, root) %{_initrddir}/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{confdir}/postgrey_whitelist_clients
%config(noreplace) %{confdir}/postgrey_whitelist_recipients
%config(noreplace) %{confdir}/postgrey_whitelist_clients.local
%attr(755, root, root) %{_sbindir}/postgrey
%attr(755, root, root) %{_sbindir}/postgreyreport
%dir %attr(0750, postfix, postfix) %{queue_directory}/%{name}

* Thu Feb 28 2008 Jan Zimmerschied
- updated postgrey to version 1.31
- created rcpostgrey link
* Tue Oct 15 2006 Wade Berrier <> 1.27
- Adapt to suse 10.0
 -add suse initrd (adapted from suse's ddclient package)
 -adjust sysconfig vars
 -patch0 (postgrey-user) is to map to suse type users

* Tue Mar 08 2005 Oden Eriksson <> 1.18-2mdk
- revert to the package by Luca Berra (sorry)

* Tue Mar 08 2005 Oden Eriksson <> 1.18-1mdk
- mistake

* Mon Jan 03 2005 Luca Berra <> 1.17-1mdk
- Initial release based on redhat package from Levente Farkas