postgrey.spec 4.9 KB

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