view postfwd.spec @ 1:0c0c93f9123b default tip

Add .hgignore file
author Guido Berhoerster <guido+packaging@berhoerster.name>
date Sat, 27 Jul 2013 13:48:15 +0200
parents e03652c59c7d
children
line wrap: on
line source

Name:           postfwd
Version:        1.34
Release:        1%{?dist}
Summary:        Flexible Postfix Policy Daemon

Group:          System Environment/Daemons
License:        BSD
URL:            http://www.postfwd.org
Source0:        http://www.postfwd.org/%{name}-%{version}.tar.gz
Source1:        postfwd.init
Source2:        postfwd.sysconf
Source3:        postfwd.cf
Patch0:         postfwd-fix-pidfile-permissions.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

BuildRequires:  perl
Requires:       postfix
Requires(pre):  shadow-utils
Requires(post): chkconfig
Requires(postun): initscripts
Requires(preun): chkconfig
Requires(preun): initscripts

%description
postfwd is a Postfix policy daemon which combines complex Postfix restrictions
in a ruleset similar to those of the most firewalls. The program uses the
Postfix policy delegation protocol to control access to the mail system before
a message has been accepted . It allows you to choose an action (e.g. reject,
dunno) for a combination of several SMTP parameters (like sender and recipient
address, size or the client's TLS fingerprint).

%prep
%setup -q
%patch0 -p1
# move example scripts and data to a single directory
mkdir doc/examples
mv plugins/ etc/* tools/*.sample tools/*.pl doc/examples/
mv tools/hapolicy/hapolicy.* doc
# ensure example scripts, plugins are non-executable
find doc -type f -exec chmod 644 {} \+
# fix CR+LF line endings
sed -i 's/\x0D$//' doc/postfwd2-chroot.txt

%build

%install
rm -rf %{buildroot}
install -D -m 755 -p sbin/postfwd %{buildroot}%{_sbindir}/postfwd
install -D -m 755 -p sbin/postfwd2 %{buildroot}%{_sbindir}/postfwd2
install -D -m 755 -p tools/hapolicy/hapolicy %{buildroot}%{_sbindir}/hapolicy
install -D -m 644 -p man/man8/postfwd.8 %{buildroot}%{_mandir}/man8/postfwd.8
install -D -m 644 -p man/man8/postfwd2.8 %{buildroot}%{_mandir}/man8/postfwd2.8
pod2man tools/hapolicy/hapolicy > %{buildroot}%{_mandir}/man8/hapolicy.8
install -D -m 755 -p %{SOURCE1} %{buildroot}%{_initddir}/%{name}
install -D -m 644 -p %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -D -m 644 -p %{SOURCE3} %{buildroot}%{_sysconfdir}/postfwd.cf
install -d -m 750 %{buildroot}%{_var}/spool/postfix/postfwd
install -d -m 750 %{buildroot}%{_var}/cache/postfwd

%clean
rm -rf %{buildroot}

%pre
getent group postfwd >/dev/null || groupadd -r postfwd
getent passwd postfwd >/dev/null || \
    useradd -r -g postfwd -d %{_var}/spool/postfix/postfwd -s /sbin/nologin \
    -c "postfwd daemon user" postfwd
exit 0

%post
/sbin/chkconfig --add postfwd

%preun
if [ $1 -eq 0 ] ; then
    /sbin/service postfwd stop >/dev/null 2>&1
    /sbin/chkconfig --del postfwd
fi

%postun
if [ "$1" -ge 1 ] ; then
    /sbin/service postfwd condrestart >/dev/null 2>&1 || :
fi


%files
%defattr(-,root,root,-)
%doc doc/*
%{_initddir}/postfwd
%config(noreplace) %{_sysconfdir}/sysconfig/postfwd
%config(noreplace) %{_sysconfdir}/postfwd.cf
%{_sbindir}/postfwd*
%{_sbindir}/hapolicy
%{_mandir}/man8/postfwd*.8*
%{_mandir}/man8/hapolicy.8*
%dir %attr(0750,postfwd,postfix) %{_var}/spool/postfix/postfwd/
%dir %attr(0750,postfwd,postfwd) %{_var}/cache/postfwd/

%changelog
* Wed Jan 09 2013 Guido Berhoerster <guido+packaging@berhoerster.name> - 1.34-1
- Initial packaging