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"
55 # Needed for new no-symlink profiles,
56 # see https://bazaar.launchpad.net/~mailman-coders/mailman/2.1/revision/1819
57 epatch "${FILESDIR}/mailman-2.1.29-fix-libdir.diff"
63 --prefix="${INSTALLDIR}" \
64 --with-mail-gid=${MAILGID} \
65 --with-cgi-gid=${CGIGID} \
66 --with-cgi-ext="${MAILMAN_CGIEXT}" \
67 --with-var-prefix="${VAR_PREFIX}" \
68 --with-username=${MAILUSR} \
69 --with-groupname=${MAILGRP} \
70 --with-python="${PYTHON}"
74 emake "DESTDIR=${D}" doinstall
76 insinto /etc/apache2/modules.d
77 newins "${FILESDIR}/50_mailman.conf-r2" 50_mailman.conf
79 -e "s:/usr/local/mailman/cgi-bin:${INSTALLDIR}/cgi-bin:g" \
80 -e "s:/usr/local/mailman/icons:${INSTALLDIR}/icons:g" \
81 -e "s:/usr/local/mailman/archives:${VAR_PREFIX}/archives:g" \
82 -i "${D}/etc/apache2/modules.d/50_mailman.conf" || die
84 newdoc "${FILESDIR}/README.gentoo-r3" README.gentoo
86 dodoc ACK* BUGS FAQ NEWS README* TODO UPGRADING INSTALL contrib/mailman.mc \
87 contrib/README.check_perms_grsecurity contrib/virtusertable
89 exeinto ${INSTALLDIR}/bin
90 doexe build/contrib/*.py contrib/majordomo2mailman.pl contrib/auto \
94 mv "${D}/${INSTALLDIR}/Mailman/mm_cfg.py" "${D}/etc/mailman"
95 dosym /etc/mailman/mm_cfg.py ${INSTALLDIR}/Mailman/mm_cfg.py
97 # Save the old config for updates from pre-2.1.9-r2
98 # To be removed some distant day
99 for i in /var/mailman /home/mailman /usr/local/mailman ${INSTALLDIR}; do
100 if [ -f ${i}/Mailman/mm_cfg.py ] && ! [ -L ${i}/Mailman/mm_cfg.py ]; then
101 cp ${i}/Mailman/mm_cfg.py "${D}/etc/mailman/mm_cfg.py" || die
105 newinitd "${FILESDIR}/mailman.rc" mailman
106 cp "${FILESDIR}/mailman.service" "${T}/mailman.service" || die
107 sed -i "s/^User=.*/User=${MAILUSR}/" "${T}/mailman.service" || die
108 systemd_dounit "${T}/mailman.service"
110 keepdir ${VAR_PREFIX}/logs
111 keepdir ${VAR_PREFIX}/locks
112 keepdir ${VAR_PREFIX}/spam
113 keepdir ${VAR_PREFIX}/archives/public
114 keepdir ${VAR_PREFIX}/archives/private
115 keepdir ${VAR_PREFIX}/lists
116 keepdir ${VAR_PREFIX}/qfiles
118 chown -R ${MAILUSR}:${MAILGRP} "${D}/${VAR_PREFIX}" "${D}/${INSTALLDIR}" "${D}"/etc/mailman/* || die
119 chown ${CGIUID}:${MAILGRP} "${D}/${VAR_PREFIX}/archives/private" || die
120 chmod 2775 "${D}/${INSTALLDIR}" "${D}/${INSTALLDIR}"/templates/* \
121 "${D}/${INSTALLDIR}"/messages/* "${D}/${VAR_PREFIX}" "${D}/${VAR_PREFIX}"/{logs,lists,spam,locks,archives/public} || die
122 chmod 2770 "${D}/${VAR_PREFIX}/archives/private" || die
123 chmod 2770 "${D}/${VAR_PREFIX}/qfiles" || die
124 chmod 2755 "${D}/${INSTALLDIR}"/cgi-bin/* "${D}/${INSTALLDIR}/mail/mailman" || die
126 python_optimize "${D}/${INSTALLDIR}/bin/" \
127 "${D}/${INSTALLDIR}/Mailman/" \
128 "${D}/${INSTALLDIR}/Mailman/*"
132 enewgroup ${MAILGRP} ${MAILGID}
133 enewuser ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman,cron
135 elog "Please read /usr/share/doc/${PF}/README.gentoo.bz2 for additional"
136 elog "Setup information, mailman will NOT run unless you follow"
137 elog "those instructions!"
140 elog "An example Mailman configuration file for Apache has been installed into:"
141 elog " ${APACHE2_MODULES_CONFDIR}/50_mailman.conf"
143 elog "To enable, you will need to add \"-D MAILMAN\" to"
144 elog "/etc/conf.d/apache2."
147 ewarn "Default-Configuration has changed deeply in 2.1.9-r2. You can configure"
148 ewarn "mailman with the following variables:"
149 ewarn "MAILMAN_PREFIX (default: /usr/$(get_libdir)/mailman)"
150 ewarn "MAILMAN_VAR_PREFIX (default: /var/lib/mailman)"
151 ewarn "MAILMAN_CGIUID (default: apache)"
152 ewarn "MAILMAN_CGIGID (default: apache)"
153 ewarn "MAILMAN_CGIEXT (default: empty)"
154 ewarn "MAILMAN_MAILUSR (default: mailman)"
155 ewarn "MAILMAN_MAILUID (default: 280)"
156 ewarn "MAILMAN_MAILGRP (default: mailman)"
157 ewarn "MAILMAN_MAILGID (default: 280)"
159 ewarn "Config file is now symlinked in /etc/mailman, so etc-update works."
161 ewarn "If you're upgrading from below 2.1.9-r2 or changed MAILMAN_PREFIX, you"
162 ewarn "NEED to make a few manual updates to your system:"
164 ewarn "1. Update your mailman users's home directory: usermod -d ${INSTALLDIR} mailman"
165 ewarn "2. Re-import the crontab: su - mailman -c 'crontab cron/crontab.in'"
166 ewarn "3. Copy your old mm_cfg.py file to /etc/mailman/mm_cfg.py"
168 ewarn "Additionally if you've modified MAILMAN_VAR_PREFIX (or upgraded from"
169 ewarn "a pre 2.1.9-r2 installation), you should move your old lists/ and"
170 ewarn "archives/ directory to the new location, ensuring that the"
171 ewarn "permissions is correct. See bug #208789 for a discussion."