1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit eutils python-single-r1 multilib systemd user
10 DESCRIPTION="A python-based mailing list server with an extensive web interface"
11 SRC_URI="mirror://sourceforge/${PN}/${P/_p/-}.tgz"
12 HOMEPAGE="http://www.list.org/"
16 KEYWORDS="amd64 ppc x86"
18 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
22 $(python_gen_cond_dep '
23 dev-python/dnspython[${PYTHON_MULTI_USEDEP}]
29 selinux? ( sec-policy/selinux-mailman )
32 S="${WORKDIR}/${P/_p/-}"
35 python-single-r1_pkg_setup
36 INSTALLDIR=${MAILMAN_PREFIX:-"/usr/$(get_libdir)/mailman"}
37 VAR_PREFIX=${MAILMAN_VAR_PREFIX:-"/var/lib/mailman"}
38 CGIUID=${MAILMAN_CGIUID:-apache}
39 CGIGID=${MAILMAN_CGIGID:-apache}
40 MAILUSR=${MAILMAN_MAILUSR:-mailman}
41 MAILUID=${MAILMAN_MAILUID:-280}
42 MAILGRP=${MAILMAN_MAILGRP:-mailman}
43 MAILGID=${MAILMAN_MAILGID:-280}
45 # Bug #58526: switch to enew{group,user}.
46 # need to add mailman here for compile process.
47 # Duplicated at pkg_postinst() for binary install.
48 enewgroup ${MAILGRP} ${MAILGID}
49 enewuser ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman,cron
53 epatch "${FILESDIR}/${PN}-2.1.14_rc1-directory-check.patch"
54 epatch "${FILESDIR}/${PN}-2.1.9-icons.patch"
60 --prefix="${INSTALLDIR}" \
61 --with-mail-gid=${MAILGID} \
62 --with-cgi-gid=${CGIGID} \
63 --with-cgi-ext="${MAILMAN_CGIEXT}" \
64 --with-var-prefix="${VAR_PREFIX}" \
65 --with-username=${MAILUSR} \
66 --with-groupname=${MAILGRP} \
67 --with-python="${PYTHON}"
71 emake "DESTDIR=${D}" doinstall
73 insinto /etc/apache2/modules.d
74 newins "${FILESDIR}/50_mailman.conf-r2" 50_mailman.conf
76 -e "s:/usr/local/mailman/cgi-bin:${INSTALLDIR}/cgi-bin:g" \
77 -e "s:/usr/local/mailman/icons:${INSTALLDIR}/icons:g" \
78 -e "s:/usr/local/mailman/archives:${VAR_PREFIX}/archives:g" \
79 -i "${D}/etc/apache2/modules.d/50_mailman.conf" || die
81 newdoc "${FILESDIR}/README.gentoo-r3" README.gentoo
83 dodoc ACK* BUGS FAQ NEWS README* TODO UPGRADING INSTALL contrib/mailman.mc \
84 contrib/README.check_perms_grsecurity contrib/virtusertable
86 exeinto ${INSTALLDIR}/bin
87 doexe build/contrib/*.py contrib/majordomo2mailman.pl contrib/auto \
91 mv "${D}/${INSTALLDIR}/Mailman/mm_cfg.py" "${D}/etc/mailman"
92 dosym /etc/mailman/mm_cfg.py ${INSTALLDIR}/Mailman/mm_cfg.py
94 # Save the old config for updates from pre-2.1.9-r2
95 # To be removed some distant day
96 for i in /var/mailman /home/mailman /usr/local/mailman ${INSTALLDIR}; do
97 if [ -f ${i}/Mailman/mm_cfg.py ] && ! [ -L ${i}/Mailman/mm_cfg.py ]; then
98 cp ${i}/Mailman/mm_cfg.py "${D}/etc/mailman/mm_cfg.py" || die
102 newinitd "${FILESDIR}/mailman.rc" mailman
103 cp "${FILESDIR}/mailman.service" "${T}/mailman.service" || die
104 sed -i "s/^User=.*/User=${MAILUSR}/" "${T}/mailman.service" || die
105 systemd_dounit "${T}/mailman.service"
107 keepdir ${VAR_PREFIX}/logs
108 keepdir ${VAR_PREFIX}/locks
109 keepdir ${VAR_PREFIX}/spam
110 keepdir ${VAR_PREFIX}/archives/public
111 keepdir ${VAR_PREFIX}/archives/private
112 keepdir ${VAR_PREFIX}/lists
113 keepdir ${VAR_PREFIX}/qfiles
115 chown -R ${MAILUSR}:${MAILGRP} "${D}/${VAR_PREFIX}" "${D}/${INSTALLDIR}" "${D}"/etc/mailman/* || die
116 chown ${CGIUID}:${MAILGRP} "${D}/${VAR_PREFIX}/archives/private" || die
117 chmod 2775 "${D}/${INSTALLDIR}" "${D}/${INSTALLDIR}"/templates/* \
118 "${D}/${INSTALLDIR}"/messages/* "${D}/${VAR_PREFIX}" "${D}/${VAR_PREFIX}"/{logs,lists,spam,locks,archives/public} || die
119 chmod 2770 "${D}/${VAR_PREFIX}/archives/private" || die
120 chmod 2770 "${D}/${VAR_PREFIX}/qfiles" || die
121 chmod 2755 "${D}/${INSTALLDIR}"/cgi-bin/* "${D}/${INSTALLDIR}/mail/mailman" || die
123 python_optimize "${D}/${INSTALLDIR}/bin/" \
124 "${D}/${INSTALLDIR}/Mailman/" \
125 "${D}/${INSTALLDIR}/Mailman/*"
129 enewgroup ${MAILGRP} ${MAILGID}
130 enewuser ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman,cron
132 elog "Please read /usr/share/doc/${PF}/README.gentoo.bz2 for additional"
133 elog "Setup information, mailman will NOT run unless you follow"
134 elog "those instructions!"
137 elog "An example Mailman configuration file for Apache has been installed into:"
138 elog " ${APACHE2_MODULES_CONFDIR}/50_mailman.conf"
140 elog "To enable, you will need to add \"-D MAILMAN\" to"
141 elog "/etc/conf.d/apache2."
144 ewarn "Default-Configuration has changed deeply in 2.1.9-r2. You can configure"
145 ewarn "mailman with the following variables:"
146 ewarn "MAILMAN_PREFIX (default: /usr/$(get_libdir)/mailman)"
147 ewarn "MAILMAN_VAR_PREFIX (default: /var/lib/mailman)"
148 ewarn "MAILMAN_CGIUID (default: apache)"
149 ewarn "MAILMAN_CGIGID (default: apache)"
150 ewarn "MAILMAN_CGIEXT (default: empty)"
151 ewarn "MAILMAN_MAILUSR (default: mailman)"
152 ewarn "MAILMAN_MAILUID (default: 280)"
153 ewarn "MAILMAN_MAILGRP (default: mailman)"
154 ewarn "MAILMAN_MAILGID (default: 280)"
156 ewarn "Config file is now symlinked in /etc/mailman, so etc-update works."
158 ewarn "If you're upgrading from below 2.1.9-r2 or changed MAILMAN_PREFIX, you"
159 ewarn "NEED to make a few manual updates to your system:"
161 ewarn "1. Update your mailman users's home directory: usermod -d ${INSTALLDIR} mailman"
162 ewarn "2. Re-import the crontab: su - mailman -c 'crontab cron/crontab.in'"
163 ewarn "3. Copy your old mm_cfg.py file to /etc/mailman/mm_cfg.py"
165 ewarn "Additionally if you've modified MAILMAN_VAR_PREFIX (or upgraded from"
166 ewarn "a pre 2.1.9-r2 installation), you should move your old lists/ and"
167 ewarn "archives/ directory to the new location, ensuring that the"
168 ewarn "permissions is correct. See bug #208789 for a discussion."