amavisd.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. ##
  2. ## amavisd.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 version
  26. %define V_major 20030616
  27. %define V_minor p9
  28. # package information
  29. Name: amavisd
  30. Summary: Interface Daemon between MTA and Content Checker
  31. URL: http://www.ijs.si/software/amavisd/
  32. Vendor: Mark Martinec
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG
  35. Class: EVAL
  36. Group: Mail
  37. License: GPL
  38. Version: %{V_major}%{V_minor}
  39. Release: 20040429
  40. # package options
  41. %option with_milter no
  42. # list of sources
  43. Source0: http://www.ijs.si/software/amavisd/amavisd-new-%{V_major}-%{V_minor}.tar.gz
  44. Source1: http://homepages.hs-bremen.de/~renegat/amavislogsumm
  45. Source2: rc.amavisd
  46. # build information
  47. Prefix: %{l_prefix}
  48. BuildRoot: %{l_buildroot}
  49. BuildPreReq: OpenPKG, openpkg >= 20040130, sed
  50. PreReq: OpenPKG, openpkg >= 20040130, spamassassin
  51. PreReq: perl, perl-net, perl-util, perl-mail, perl-time
  52. PreReq: perl-sys, perl-comp, perl-conv
  53. %if "%{with_milter}" == "yes"
  54. BuildPreReq: sendmail, sendmail::with_milter = yes
  55. PreReq: sendmail, sendmail::with_milter = yes
  56. %endif
  57. AutoReq: no
  58. AutoReqProv: no
  59. %description
  60. amavisd-new is a high-performance interface between mailer (MTA) and
  61. content checkers: virus scanners, and/or SpamAssassin. It is written
  62. in Perl for maintainability, without paying a significant price
  63. for speed. It talks to MTA via (E)SMTP or LMTP, or by using helper
  64. programs. Best with Postfix, works with Exim, sendmail/milter, or
  65. with any MTA as a SMTP relay.
  66. %track
  67. prog amavisd = {
  68. version = %{V_major}-%{V_minor}
  69. url = http://www.ijs.si/software/amavisd/
  70. regex = amavisd-new-(%{V_major}-p\d+)\.tar\.gz
  71. }
  72. %prep
  73. %setup -q -n amavisd-new-%{V_major}
  74. %{l_shtool} subst \
  75. -e "s;'clamscan';%{l_prefix}/bin/clamscan;g" \
  76. -e "s;'uvscan';%{l_prefix}/bin/uvscan;g" \
  77. -e 's;/var/amavis/clamd;%{l_prefix}/var/clamav/clamd.sock;g' \
  78. -e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
  79. -e 's;/var/virusmails;%{l_prefix}/var/amavisd/virusmails;g' \
  80. -e 's;/usr/bin/sendmail;%{l_prefix}/sbin/sendmail;g' \
  81. -e 's; -C/etc/sendmail\.orig\.cf;;g' \
  82. -e 's;/usr/bin/exim;%{l_prefix}/bin/exim;g' \
  83. -e 's;/usr/local/sbin;%{l_prefix}/sbin;g' \
  84. -e 's;/usr/local/bin;%{l_prefix}/bin;g' \
  85. -e 's;\(daemon_user *= \)[^;]*;\1q{%{l_rusr}};' \
  86. -e 's;\(daemon_group *= \)[^;]*;\1q{%{l_rgrp}};' \
  87. -e 's;\(\$DO_SYSLOG *= \)[^;]*;\10;' \
  88. -e 's;\(\$LOGFILE *=.*\)amavis.log\([^ \t]*\) \(.*\);\1amavisd.log\2\3;' \
  89. -e 's;\(\$path *=.*\)/usr/local/sbin\(.*\);\1%{l_prefix}/sbin:%{l_prefix}/bin:/usr/local/sbin\2;' \
  90. amavisd.conf
  91. %{l_shtool} subst \
  92. -e '1s;/usr/bin/perl;%{l_prefix}/bin/perl;' \
  93. -e 's;/var/amavis;%{l_prefix}/var/amavisd;g' \
  94. -e 's;/usr/lib/spamassassin;%{l_prefix}/lib/spamassassin;g' \
  95. amavisd
  96. %build
  97. %if "%{with_milter}" == "yes"
  98. cd helper-progs
  99. CC="%{l_cc}" \
  100. CFLAGS="%{l_cflags -O}" \
  101. LDFLAGS="%{l_ldflags}" \
  102. ./configure
  103. --prefix="%{l_prefix}" \
  104. --with-sendmail="%{l_prefix}/sbin/sendmail" \
  105. --with-runtime-dir="%{l_prefix}/var/amavisd" \
  106. --with-sockname="%{l_prefix}/var/amavisd/amavisd.sock" \
  107. --with-user="%{l_rusr}" \
  108. --with-milterinc="%{l_prefix}/include/libmilter" \
  109. --with-milterlib="%{l_prefix}/lib"
  110. %endif
  111. %install
  112. rm -rf $RPM_BUILD_ROOT
  113. %{l_shtool} mkdir -f -p -m 755 \
  114. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  115. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  116. $RPM_BUILD_ROOT%{l_prefix}/etc/amavisd \
  117. $RPM_BUILD_ROOT%{l_prefix}/share/amavisd/tests \
  118. $RPM_BUILD_ROOT%{l_prefix}/var/amavisd \
  119. $RPM_BUILD_ROOT%{l_prefix}/var/amavisd/virusmails
  120. %{l_shtool} install -c -m 755 \
  121. amavisd \
  122. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  123. %{l_shtool} install -c -m 644 \
  124. amavisd.conf \
  125. $RPM_BUILD_ROOT%{l_prefix}/etc/amavisd/
  126. %{l_shtool} install -c -m 644 \
  127. test-messages/* \
  128. $RPM_BUILD_ROOT%{l_prefix}/share/amavisd/tests/
  129. %{l_shtool} install -c -m 644 \
  130. RELEASE_NOTES README_FILES/* \
  131. $RPM_BUILD_ROOT%{l_prefix}/share/amavisd/
  132. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  133. %{SOURCE rc.amavisd} \
  134. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  135. %{l_shtool} install -c -m 755 \
  136. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
  137. %{SOURCE amavislogsumm} \
  138. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  139. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  140. '%config %{l_prefix}/etc/amavisd/amavisd.conf' \
  141. '%attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/amavisd' \
  142. '%attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/amavisd/virusmails'
  143. %files -f files
  144. %clean
  145. rm -rf $RPM_BUILD_ROOT
  146. %pre
  147. # before upgrade, save status and stop service
  148. [ $1 -eq 2 ] || exit 0
  149. eval `%{l_rc} amavisd status 2>/dev/null | tee %{l_tmpfile}`
  150. %{l_rc} amavisd stop 2>/dev/null
  151. exit 0
  152. %post
  153. if [ $1 -eq 2 ]; then
  154. # after upgrade, restore status
  155. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  156. [ ".$amavisd_active" = .yes ] && %{l_rc} amavisd start
  157. fi
  158. exit 0
  159. %preun
  160. # before erase, stop service and remove log files
  161. [ $1 -eq 0 ] || exit 0
  162. %{l_rc} amavisd stop 2>/dev/null
  163. rm -f $RPM_INSTALL_PREFIX/var/amavisd/*.log* >/dev/null 2>&1 || true
  164. rm -f $RPM_INSTALL_PREFIX/var/amavisd/*.sum* >/dev/null 2>&1 || true
  165. exit 0