postgrey.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ##
  2. ## postgrey.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: postgrey
  26. Summary: Postfix Greylisting Daemon
  27. URL: http://postgrey.schweikert.ch/
  28. Vendor: David Schweikert
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: BASE
  32. Group: Mail
  33. License: GPL
  34. Version: 1.31
  35. Release: 20071108
  36. # list of sources
  37. Source0: http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz
  38. Source1: rc.postgrey
  39. Source2: whitelist.clients
  40. Source3: whitelist.recipients
  41. Patch0: postgrey.patch
  42. # build information
  43. Prefix: %{l_prefix}
  44. BuildRoot: %{l_buildroot}
  45. BuildPreReq: OpenPKG, openpkg >= 20060823
  46. PreReq: OpenPKG, openpkg >= 20060823
  47. BuildPreReq: perl
  48. PreReq: perl, perl-sys, perl-net, perl-db, perl-dns
  49. AutoReq: no
  50. AutoReqProv: no
  51. %description
  52. Postgrey is a Postfix MTA policy server implementing Greylisting.
  53. Related to whitelists and blacklists, a greylist indicates those
  54. emails (originating from unknown IPs) which are rejected with a
  55. "try again later" message. The email in question will be delayed
  56. until the sending MTA tries again, but this is where spam loses
  57. out. Most spam is not sent out using RFC compliant MTAs, and so
  58. the spamming software will not "try again later".
  59. %track
  60. prog postgrey = {
  61. version = %{version}
  62. url = http://postgrey.schweikert.ch/pub/
  63. regex = postgrey-(__VER__)\.tar\.gz
  64. }
  65. %prep
  66. %setup -q
  67. %patch -p0
  68. %build
  69. # build manual page
  70. for i in postgrey contrib/postgreyreport; do
  71. pod2man $i >$i.8
  72. %{l_shtool} subst \
  73. -e 's;/etc/postfix/postgrey_\([a-z_.]\{1,\}\);%{l_prefix}/etc/postgrey/\1;g' \
  74. -e 's;/etc/postfix;%{l_prefix}/etc/postfix;g' \
  75. -e 's;/etc/main.cf;%{l_prefix}/etc/postfix/main.cf;g' \
  76. -e 's;/var/log/maillog;%{l_prefix}/var/postfix/log/postfix.log;g' \
  77. -e 's;/var/spool/postfix/postgrey;%{l_prefix}/var/postgrey;g' \
  78. $i.8
  79. done
  80. %install
  81. # create installation hierarchy
  82. rm -rf $RPM_BUILD_ROOT
  83. %{l_shtool} mkdir -f -p -m 755 \
  84. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  85. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  86. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  87. $RPM_BUILD_ROOT%{l_prefix}/etc/postgrey \
  88. $RPM_BUILD_ROOT%{l_prefix}/var/postgrey
  89. # install programs and manual pages
  90. %{l_shtool} install -c -m 755 \
  91. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
  92. -e "s;\\(.\\)Sys::Syslog\\(. : undef\\);\\1%{l_prefix}/var/postgrey/postgrey.log\\2;" \
  93. postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/
  94. %{l_shtool} install -c -m 755 \
  95. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
  96. -e 's;/var/spool/postfix/postgrey;%{l_prefix}/var/postgrey;' \
  97. -e 's;\(=> .\)postgrey\(.\);\1%{l_rusr}\2;' \
  98. contrib/postgreyreport $RPM_BUILD_ROOT%{l_prefix}/sbin/
  99. %{l_shtool} install -c -m 644 \
  100. postgrey.8 contrib/postgreyreport.8 \
  101. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  102. # install configuration files
  103. %{l_shtool} install -c -m 644 \
  104. %{SOURCE whitelist.clients} \
  105. %{SOURCE whitelist.recipients} \
  106. $RPM_BUILD_ROOT%{l_prefix}/etc/postgrey/
  107. # install run-command script
  108. %{l_shtool} mkdir -f -p -m 755 \
  109. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  110. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  111. %{SOURCE rc.postgrey} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  112. # determine installation files
  113. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  114. %{l_files_std} \
  115. '%config %{l_prefix}/etc/postgrey/*' \
  116. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/postgrey'
  117. %files -f files
  118. %clean
  119. rm -rf $RPM_BUILD_ROOT
  120. %post
  121. # after upgrade, restart service
  122. [ $1 -eq 2 ] || exit 0
  123. eval `%{l_rc} postgrey status 2>/dev/null`
  124. [ ".$postgrey_active" = .yes ] && %{l_rc} postgrey restart
  125. exit 0
  126. %preun
  127. # before erase, stop service and remove log files
  128. [ $1 -eq 0 ] || exit 0
  129. %{l_rc} postgrey stop 2>/dev/null
  130. rm -f $RPM_INSTALL_PREFIX/var/postgrey/*
  131. exit 0