mailman.spec 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ##
  2. ## mailman.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # FIXME: rse: is this packaging complete?
  24. # package information
  25. Name: mailman
  26. Summary: Mailing List Management System
  27. URL: http://www.list.org/
  28. Vendor: John Viega et al.
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: Mail
  33. License: GPL
  34. Version: 2.1.10
  35. Release: 20080422
  36. # list of sources
  37. Source0: http://switch.dl.sourceforge.net/mailman/mailman-%{version}.tgz
  38. Source1: manpages.tar.gz
  39. Source2: mailman-sendmail.m4
  40. Source3: mailman-apache.conf
  41. Source4: rc.mailman
  42. Patch0: mailman.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20060823, python
  47. PreReq: OpenPKG, openpkg >= 20060823, python, MTA
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. Mailman is software to help manage email discussion lists, much
  52. like Majordomo and Smartmail. Unlike most similar products, Mailman
  53. gives each mailing list a webpage, and allows users to subscribe,
  54. unsubscribe, etc. over the Web. Even the list manager can administer
  55. his or her list entirely from the Web. Mailman also integrates most
  56. things people want to do with mailing lists, including archiving,
  57. mail/news gateways, and so on.
  58. %track
  59. prog mailman = {
  60. version = %{version}
  61. url = http://prdownloads.sourceforge.net/mailman/
  62. regex = mailman-(\d+\.\d+\.\d+)\.tgz
  63. }
  64. %prep
  65. %setup -q
  66. %setup -q -D -T -a 1
  67. %patch -p0
  68. %build
  69. # configure package
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. CPPFLAGS="%{l_cppflags}" \
  73. LDFLAGS="%{l_ldflags}" \
  74. ./configure \
  75. --prefix=%{l_prefix}/libexec/mailman \
  76. --exec-prefix=%{l_prefix}/libexec/mailman \
  77. --sysconfdir=%{l_prefix}/etc/mailman \
  78. --with-var-prefix=%{l_prefix}/var/mailman \
  79. --with-username=%{l_nusr} \
  80. --with-groupname=%{l_mgrp} \
  81. --with-cgi-gid=%{l_ngrp} \
  82. --with-mail-gid=%{l_mgrp} \
  83. --with-cgi-ext="" \
  84. --with-urlhost="localhost" \
  85. --with-mailhost="localhost" \
  86. --without-permcheck \
  87. --enable-static
  88. # build package
  89. %{l_make} %{l_mflags}
  90. %install
  91. # install package
  92. rm -rf $RPM_BUILD_ROOT
  93. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT DIRSETGID=true
  94. # create additional directories
  95. %{l_shtool} mkdir -f -p -m 755 \
  96. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  97. $RPM_BUILD_ROOT%{l_prefix}/etc/mailman \
  98. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  99. # strip down installation tree
  100. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/tests
  101. # install Sendmail mailer handler
  102. %{l_shtool} install -c -m 755 \
  103. -e 's;#!/usr/local/bin/perl;#!%{l_prefix}/bin/perl;' \
  104. -e 's;/home/mailman/mail/mailman;%{l_prefix}/libexec/mailman/mail/mailman;' \
  105. -e 's;/home/mailman/lists;%{l_prefix}/var/mailman/lists;' \
  106. -e 's;/usr/lib/sendmail;%{l_prefix}/sbin/sendmail;' \
  107. contrib/mm-handler \
  108. $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/mail/mailman-sendmail
  109. # install Apache and Sendmail configurations
  110. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  111. %{SOURCE mailman-sendmail.m4} %{SOURCE mailman-apache.conf} \
  112. $RPM_BUILD_ROOT%{l_prefix}/etc/mailman/
  113. # install manual pages
  114. %{l_shtool} install -c -m 644 \
  115. man8/*.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  116. # post-adjust default configuration
  117. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py \
  118. $RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
  119. ln -s %{l_prefix}/etc/mailman/mailman.cfg \
  120. $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py
  121. ( echo ""
  122. echo "DEFAULT_EMAIL_HOST = 'host.example.com'"
  123. echo "DEFAULT_URL_HOST = 'host.example.com'"
  124. echo "IMAGE_LOGOS = '/mailman/icons/'"
  125. echo "PUBLIC_ARCHIVE_URL = '/mailman/pipermail/%%(listname)s'"
  126. echo "MAILMAN_USER = '%{l_nusr}'"
  127. echo "MAILMAN_GROUP = '%{l_mgrp}'"
  128. echo "DEFAULT_SERVER_LANGUAGE = 'en'"
  129. echo "VERP_PASSWORD_REMINDERS = 1"
  130. echo "VERP_PERSONALIZED_DELIVERIES = 1"
  131. echo "VERP_CONFIRMATIONS = 1"
  132. echo "VERP_DELIVERY_INTERVAL = 1"
  133. echo ""
  134. echo "# For available options and their descriptions see:"
  135. echo "# %{l_prefix}/libexec/mailman/Mailman/Defaults.py"
  136. echo ""
  137. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
  138. # install run-command script
  139. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  140. %{SOURCE rc.mailman} ${RPM_BUILD_ROOT}%{l_prefix}/etc/rc.d/
  141. # determine installation files
  142. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  143. %{l_files_std} \
  144. '%dir %attr(2700,%{l_nusr},%{l_mgrp}) %{l_prefix}/libexec/mailman/mail/mailman-sendmail' \
  145. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman' \
  146. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/logs' \
  147. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/spam' \
  148. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/qfiles' \
  149. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/locks' \
  150. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/lists' \
  151. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives' \
  152. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives/*' \
  153. '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/data' \
  154. '%config %attr(0640,%{l_nusr},%{l_mgrp}) %{l_prefix}/etc/mailman/mailman.cfg' \
  155. '%config %{l_prefix}/etc/mailman/*'
  156. %files -f files
  157. %clean
  158. rm -rf $RPM_BUILD_ROOT
  159. %post
  160. # add hook to MTA configuration
  161. if [ $1 -eq 1 ]; then
  162. aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
  163. update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
  164. if [ ".$aliases_file" != . ]; then
  165. ( echo "mailman: postmaster"
  166. echo "mailman-owner: postmaster"
  167. ) |\
  168. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  169. -a -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
  170. fi
  171. if [ ".$update_command" != . ]; then
  172. eval $update_command
  173. fi
  174. fi
  175. # after upgrade, restart service
  176. [ $1 -eq 2 ] || exit 0
  177. $RPM_INSTALL_PREFIX/libexec/mailman/bin/update
  178. eval `%{l_rc} mailman status 2>/dev/null`
  179. [ ".$mailman_active" = .yes ] && %{l_rc} mailman restart
  180. exit 0
  181. %preun
  182. # before erase, stop service (and remove files)
  183. [ $1 -eq 0 ] || exit 0
  184. rm -f $RPM_INSTALL_PREFIX/libexec/mailman/bin/paths.pyc >/dev/null 2>&1 || true
  185. rm -f $RPM_INSTALL_PREFIX/libexec/mailman/cron/paths.pyc >/dev/null 2>&1 || true
  186. rm -f $RPM_INSTALL_PREFIX/libexec/mailman/scripts/paths.pyc >/dev/null 2>&1 || true
  187. %{l_rc} mailman stop 2>/dev/null
  188. exit 0
  189. %postun
  190. # remove hook from MTA configuration
  191. [ $1 -eq 0 ] || exit 0
  192. aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
  193. update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
  194. if [ ".$aliases_file" != . ]; then
  195. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  196. -r -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
  197. fi
  198. if [ ".$update_command" != . ]; then
  199. eval $update_command
  200. fi