File pop-before-smtp.spec of Package pop-before-smtp
#
# spec file for package pop-before-smtp
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: pop-before-smtp
Summary: Watch log for POP/IMAP auth, notify Postfix to allow relay
License: GPL-2.0-or-later
Group: Productivity/Networking/Email/Utilities
Version: 1.50
Release: 0
#Url: http://popbsmtp.sourceforge.net/
#Source: https://sourceforge.net/projects/popbsmtp/files/Source%20tar/1.42/pop-before-smtp-1.42.tar.gz/download
#Source: https://sourceforge.net/projects/popbsmtp/files/latest/download?source=files
URL: https://www.github.com/computersalat/%{name}
Source: https://www.github.com/computersalat/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}.init
Source2: %{name}.service
Patch0: %{name}-1.42-SuSE.patch
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: perl(BerkeleyDB)
Requires: perl(Net::IP::Lite)
Requires: perl(Net::Netmask)
### perl-TimeDate
Requires: postfix
Requires: perl(Date::Parse)
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%else
Requires(pre): %insserv_prereq
%endif
%description
Spam prevention requires preventing open relaying through email
servers. However, legit users want to be able to relay. If legit
users always stayed in one spot, they'd be easy to describe to the
daemon. However, what with roving laptops, logins from home, etc.,
legit users refuse to stay in one spot.
pop-before-smtp watches the mail log, looking for successful
pop/imap logins, and posts the originating IP address into a
database which can be checked by Postfix, to allow relaying for
people who have recently downloaded their email.
Copyright: 1999, 2000, 2001 Bennett Todd
2002, 2003, 2004 Wayne Davison
%prep
%setup -q
%patch0
chmod 644 ChangeLog
%build
#echo Nothing to build...
%install
install -d %{buildroot}%{_mandir}/man8
pod2man %{name} > %{buildroot}%{_mandir}/man8/%{name}.8
gzip %{buildroot}%{_mandir}/man8/%{name}.8
perl -i -e 'undef $/; $_ = <>; s/\n=head1.*\n=cut//s; print' %{buildroot}%{_sbindir}/%{name}
install -D -m 0755 %{name} %{buildroot}%{_sbindir}/%{name}
install -D -m 0644 %{name}-conf.pl %{buildroot}%{_sysconfdir}/%{name}-conf.pl
# systemd vs SysVinit
%if 0%{?has_systemd}
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service
ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
%else #SysVinit
install -D -m 0755 %{S:1} %{buildroot}/%{_sysconfdir}/init.d/%{name}
ln -sf %{_sysconfdir}/init.d/%{name} %{buildroot}/%{_sbindir}/rc%{name}
%endif
%pre
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif
%post
%if 0%{?has_systemd}
%service_add_post %{name}.service
%{fillup_only mailgraph}
%else
%{fillup_and_insserv -f pop-before-smtp}
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%{insserv_cleanup}
%endif
%files
%defattr(-,root,root)
%doc ChangeLog README TODO
%if 0%{?suse_version} >= 01200
%license COPYING
%else
%doc COPYING
%endif
%doc contrib/README*
%{_mandir}/man8/*
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%config(noreplace) %{_sysconfdir}/%{name}-conf.pl
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%else
%{_sysconfdir}/init.d/%{name}
%endif
%changelog