diff --git a/postgrey-tmpfiles.conf b/postgrey-tmpfiles.conf new file mode 100644 index 0000000..19c61d1 --- /dev/null +++ b/postgrey-tmpfiles.conf @@ -0,0 +1 @@ +d /var/run/postgrey 0755 postgrey postgrey - diff --git a/postgrey.spec b/postgrey.spec index c4d99b2..2f3ebf9 100644 --- a/postgrey.spec +++ b/postgrey.spec @@ -1,32 +1,29 @@ -%define confdir %{_sysconfdir}/postfix +%global confdir %{_sysconfdir}/postfix -Summary: Postfix Greylisting Policy Server -Name: postgrey -Version: 1.34 -Release: 8%{?dist} +Name: postgrey +Version: 1.34 +Release: 8%{?dist} # File headers only state "GNU GPL", but the LICENSE sections state v2 and "any # later version" -License: GPLv2+ -Group: System Environment/Daemons -URL: http://postgrey.schweikert.ch/ -Source0: http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz -Source1: postgrey.service -Source2: README-rpm -Source3: postgrey.sysconfig -Patch0: postgrey-1.28-group.patch -Patch1: postgrey-1.34-perl-5.18.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: systemd-units +Summary: Postfix Greylisting Policy Server +License: GPLv2+ +URL: http://postgrey.schweikert.ch/ +Source0: http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz +Source1: postgrey.service +Source2: README-rpm +Source3: postgrey.sysconfig +Source4: postgrey-tmpfiles.conf +Patch0: postgrey-1.28-group.patch +Patch1: postgrey-1.34-perl-5.18.patch +BuildArch: noarch +BuildRequires: systemd # We require postfix for its directories and gid -Requires: postfix -Requires(pre): /usr/sbin/useradd -#Requires(post): /sbin/chkconfig -#Requires(preun): /sbin/service, /sbin/chkconfig -#Requires(postun): /sbin/service -Requires(post): systemd-units -Requires(preun): systemd-units -Requires(postun): systemd-units -BuildArch: noarch +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +Requires: postfix +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %description Postgrey is a Postfix policy server implementing greylisting. When a request @@ -36,13 +33,11 @@ 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. - %prep %setup -q %patch0 -p1 -b .group %patch1 -p1 -b .perl-5.18 -%{__install} -p -m 0644 %{SOURCE2} README-rpm - +install -pm0644 %{SOURCE2} README-rpm %build # We only have perl scripts, so just "build" the man page @@ -51,76 +46,53 @@ pod2man \ --section="8" \ postgrey > postgrey.8 - %install -%{__rm} -rf %{buildroot} - # Configuration files -%{__mkdir_p} %{buildroot}%{confdir} -%{__install} -p -m 0644 postgrey_whitelist_{clients,recipients} \ +mkdir -p %{buildroot}%{confdir} +istall -pm0644 postgrey_whitelist_{clients,recipients} \ %{buildroot}%{confdir}/ # Local whitelist file echo "# Clients that should not be greylisted. See postgrey(8)." \ > %{buildroot}%{confdir}/postgrey_whitelist_clients.local # Main script -%{__install} -D -p -m 0755 postgrey %{buildroot}%{_sbindir}/postgrey +install -pDm0755 postgrey %{buildroot}%{_sbindir}/postgrey # Spool directory -%{__mkdir_p} %{buildroot}%{_var}/spool/postfix/postgrey +mkdir -p %{buildroot}%{_localstatedir}/spool/postfix/postgrey # Init script -%{__install} -D -p -m 0644 %{SOURCE1} \ +install -pDm0644 %{SOURCE1} \ %{buildroot}%{_unitdir}/postgrey.service # Sysconfig -%{__install} -D -p -m 0644 %{SOURCE3} \ +install -pDm0644 %{SOURCE3} \ %{buildroot}%{_sysconfdir}/sysconfig/postgrey # Man page -%{__install} -D -p -m 0644 postgrey.8 \ +install -pDm0644 postgrey.8 \ %{buildroot}%{_mandir}/man8/postgrey.8 # Optional report script -%{__install} -D -p -m 0755 contrib/postgreyreport \ +install -pDm0755 contrib/postgreyreport \ %{buildroot}%{_sbindir}/postgreyreport - -%clean -%{__rm} -rf %{buildroot} - +# Tmpfiles.d +mkdir -p %{buildroot}%{_tmpfilesdir} +install -m0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf %pre -/usr/sbin/useradd -d %{_var}/spool/postfix/postgrey -s /sbin/nologin \ +/usr/sbin/useradd -d %{_localstatedir}/spool/postfix/postgrey -s /sbin/nologin \ -M -r postgrey &>/dev/null || : %post -#/sbin/chkconfig --add postgrey -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%systemd_post postgrey.service %preun -#if [ $1 -eq 0 ]; then -# /sbin/service postgrey stop &>/dev/null || : -# /sbin/chkconfig --del postgrey -#fi -if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable postgrey.service > /dev/null 2>&1 || : - /bin/systemctl stop postgrey.service > /dev/null 2>&1 || : -fi +%systemd_preun postgrey.service %postun -#if [ $1 -ge 1 ]; then -# /sbin/service postgrey condrestart &>/dev/null || : -#fi -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ $1 -ge 1 ] ; then - # Package upgrade, not uninstall - /bin/systemctl try-restart postgrey.service >/dev/null 2>&1 || : -fi +%systemd_postun postgrey.service %triggerun -- postgrey < 1.34-3 # Save the current service runlevel info @@ -133,9 +105,10 @@ fi /bin/systemctl try-restart postgrey.service >/dev/null 2>&1 || : %files -%defattr(-,root,root,-) %doc Changes COPYING README README-rpm %{_unitdir}/postgrey.service +%{_tmpfilesdir}/postgrey.conf +%{_localstatedir}/run/postgrey %{_sysconfdir}/sysconfig/postgrey %config(noreplace) %{confdir}/postgrey_whitelist_clients %config(noreplace) %{confdir}/postgrey_whitelist_recipients @@ -143,8 +116,7 @@ fi %{_sbindir}/postgrey %{_sbindir}/postgreyreport %{_mandir}/man8/postgrey.8* -%dir %attr(0751,postgrey,postfix) %{_var}/spool/postfix/postgrey/ - +%dir %attr(0751,postgrey,postfix) %{_localstatedir}/spool/postfix/postgrey/ %changelog * Wed Jan 01 2014 Nils Philippsen - 1.34-8