]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - net-mail/mailman/mailman-2.1.15.ebuild
950d70412a0b1a34c5fcfdb2d5f3d53a77cf8a4b
[mjo-overlay.git] / net-mail / mailman / mailman-2.1.15.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-mail/mailman/mailman-2.1.14.ebuild,v 1.7 2011/11/02 22:09:34 vapier Exp $
4
5 inherit eutils python multilib
6
7 DESCRIPTION="A python-based mailing list server with an extensive web interface"
8 SRC_URI="mirror://sourceforge/${PN}/${P}.tgz"
9 HOMEPAGE="http://www.list.org/"
10
11 SLOT="0"
12 LICENSE="GPL-2"
13 KEYWORDS="amd64 ppc sparc x86"
14 IUSE=""
15
16 DEPEND=">=dev-lang/python-2.3
17 virtual/mta
18 virtual/cron
19 virtual/httpd-cgi"
20 RDEPEND="${DEPEND}"
21
22 pkg_setup() {
23 INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
24 VAR_PREFIX=${MAILMAN_VAR_PREFIX:-"/var/lib/mailman"}
25 CGIUID=${MAILMAN_CGIUID:-apache}
26 CGIGID=${MAILMAN_CGIGID:-apache}
27 MAILUSR=${MAILMAN_MAILUSR:-mailman}
28 MAILUID=${MAILMAN_MAILUID:-280}
29 MAILGRP=${MAILMAN_MAILGRP:-mailman}
30 MAILGID=${MAILMAN_MAILGID:-280}
31
32 # Bug #58526: switch to enew{group,user}.
33 # need to add mailman here for compile process.
34 # Duplicated at pkg_postinst() for binary install.
35 enewgroup ${MAILGRP} ${MAILGID}
36 enewuser ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman,cron
37 }
38
39 src_unpack() {
40 unpack ${A}
41 cd "${S}"
42 epatch "${FILESDIR}/${PN}-2.1.14_rc1-directory-check.patch" || die "patch failed."
43 epatch "${FILESDIR}/${PN}-2.1.9-icons.patch" || die "patch failed."
44 }
45
46 src_compile() {
47 econf --without-permcheck \
48 --prefix="${INSTALLDIR}" \
49 --with-mail-gid=${MAILGID} \
50 --with-cgi-gid=${CGIGID} \
51 --with-cgi-ext="${MAILMAN_CGIEXT}" \
52 --with-var-prefix="${VAR_PREFIX}" \
53 --with-username=${MAILUSR} \
54 --with-groupname=${MAILGRP} \
55 || die "configure failed"
56
57 emake || die "make failed"
58 }
59
60 src_install () {
61 emake "DESTDIR=${D}" doinstall || die
62
63 insinto /etc/apache2/modules.d
64 newins "${FILESDIR}/50_mailman.conf-r1" 50_mailman.conf
65 dosed "s:/usr/local/mailman/cgi-bin:${INSTALLDIR}/cgi-bin:g" /etc/apache2/modules.d/50_mailman.conf
66 dosed "s:/usr/local/mailman/icons:${INSTALLDIR}/icons:g" /etc/apache2/modules.d/50_mailman.conf
67 dosed "s:/usr/local/mailman/archives:${VAR_PREFIX}/archives:g" /etc/apache2/modules.d/50_mailman.conf
68
69 newdoc "${FILESDIR}/README.gentoo-r3" README.gentoo || die "newdoc failed"
70
71 dodoc ACK* BUGS FAQ NEWS README* TODO UPGRADING INSTALL contrib/mailman.mc \
72 contrib/README.check_perms_grsecurity contrib/virtusertable || die "dodoc failed"
73
74 exeinto ${INSTALLDIR}/bin
75 doexe build/contrib/*.py contrib/majordomo2mailman.pl contrib/auto \
76 contrib/mm-handler* || die
77
78 dodir /etc/mailman
79 mv "${D}/${INSTALLDIR}/Mailman/mm_cfg.py" "${D}/etc/mailman"
80 dosym /etc/mailman/mm_cfg.py ${INSTALLDIR}/Mailman/mm_cfg.py
81
82 # Save the old config for updates from pre-2.1.9-r2
83 # To be removed some distant day
84 for i in /var/mailman /home/mailman /usr/local/mailman ${INSTALLDIR}
85 do
86 if [ -f ${i}/Mailman/mm_cfg.py ] && ! [ -L ${i}/Mailman/mm_cfg.py ]; then
87 cp ${i}/Mailman/mm_cfg.py "${D}/etc/mailman/mm_cfg.py"
88 fi
89 done
90
91 newinitd "${FILESDIR}/mailman.rc" mailman
92
93 keepdir ${VAR_PREFIX}/logs
94 keepdir ${VAR_PREFIX}/locks
95 keepdir ${VAR_PREFIX}/spam
96 keepdir ${VAR_PREFIX}/archives/public
97 keepdir ${VAR_PREFIX}/archives/private
98 keepdir ${VAR_PREFIX}/lists
99 keepdir ${VAR_PREFIX}/qfiles
100
101 chown -R ${MAILUSR}:${MAILGRP} "${D}/${VAR_PREFIX}" "${D}/${INSTALLDIR}" "${D}"/etc/mailman/*
102 chown ${CGIUID}:${MAILGRP} "${D}/${VAR_PREFIX}/archives/private"
103 chmod 2775 "${D}/${INSTALLDIR}" "${D}/${INSTALLDIR}"/templates/* \
104 "${D}/${INSTALLDIR}"/messages/* "${D}/${VAR_PREFIX}" "${D}/${VAR_PREFIX}"/{logs,lists,spam,locks,archives/public}
105 chmod 2770 "${D}/${VAR_PREFIX}/archives/private"
106 chmod 2770 "${D}/${VAR_PREFIX}/qfiles"
107 chmod 2755 "${D}/${INSTALLDIR}"/cgi-bin/* "${D}/${INSTALLDIR}/mail/mailman"
108
109 }
110
111 pkg_postinst() {
112 python_mod_optimize ${INSTALLDIR}/bin/ ${INSTALLDIR}/Mailman \
113 ${INSTALLDIR}/Mailman/*/
114
115 enewgroup ${MAILGRP} ${MAILGID}
116 enewuser ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman,cron
117 elog
118 elog "Please read /usr/share/doc/${PF}/README.gentoo.bz2 for additional"
119 elog "Setup information, mailman will NOT run unless you follow"
120 elog "those instructions!"
121 elog
122
123 elog "An example Mailman configuration file for Apache has been installed into:"
124 elog " ${APACHE2_MODULES_CONFDIR}/50_mailman.conf"
125 elog
126 elog "To enable, you will need to add \"-D MAILMAN\" to"
127 elog "/etc/conf.d/apache2."
128 elog
129
130 ewarn "Default-Configuration has changed deeply in 2.1.9-r2. You can configure"
131 ewarn "mailman with the following variables:"
132 ewarn "MAILMAN_PREFIX (default: /usr/$(get_libdir)/mailman)"
133 ewarn "MAILMAN_VAR_PREFIX (default: /var/lib/mailman)"
134 ewarn "MAILMAN_CGIUID (default: apache)"
135 ewarn "MAILMAN_CGIGID (default: apache)"
136 ewarn "MAILMAN_CGIEXT (default: empty)"
137 ewarn "MAILMAN_MAILUSR (default: mailman)"
138 ewarn "MAILMAN_MAILUID (default: 280)"
139 ewarn "MAILMAN_MAILGRP (default: mailman)"
140 ewarn "MAILMAN_MAILGID (default: 280)"
141 ewarn
142 ewarn "Config file is now symlinked in /etc/mailman, so etc-update works."
143 ewarn
144 ewarn "If you're upgrading from below 2.1.9-r2 or changed MAILMAN_PREFIX, you"
145 ewarn "NEED to make a few manual updates to your system:"
146 ewarn
147 ewarn "1. Update your mailman users's home directory: usermod -d ${INSTALLDIR} mailman"
148 ewarn "2. Re-import the crontab: su - mailman -c 'crontab cron/crontab.in'"
149 ewarn "3. Copy your old mm_cfg.py file to /etc/mailman/mm_cfg.py"
150 ewarn
151 ewarn "Additionally if you've modified MAILMAN_VAR_PREFIX (or upgraded from"
152 ewarn "a pre 2.1.9-r2 installation), you should move your old lists/ and"
153 ewarn "archives/ directory to the new location, ensuring that the"
154 ewarn "permissions is correct. See bug #208789 for a discussion."
155 ebeep
156 }
157
158 pkg_postrm() {
159 INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
160 python_mod_cleanup ${INSTALLDIR}/bin ${INSTALLDIR}/Mailman \
161 ${INSTALLDIR}/Mailman/*/
162 }