##
## mailman.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2005 OpenPKG Foundation e.V.
## Copyright (c) 2000-2005 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: mailman
Summary: Mailing List Management System
URL: http://www.list.org/
Vendor: John Viega et al.
Packager: OpenPKG
Distribution: OpenPKG
Class: JUNK
Group: Network
License: GPL
Version: 2.1.5
Release: 20050501
################################################
# ##
################################################ #
# Options: # #
# list of options to use with mailman wanted a # #
# more modular configuration ##
################################################
%option with_username %{l_nusr}
%option with_groupname %{l_ngrp}
%option with_urlhost localhost
%option with_mail_gid %{l_mgrp}
%option cgigroup %{l_mgrp}
%option with_single_owner no
%option with_no_middle_icon no
%option with_two_icons no
%option with_handler_fix no
%option with_yourimage no
# list of sources
Source0: ftp://ftp.gnu.org/gnu/mailman/mailman-%{version}.tgz
Source1: manpages.tar.gz
Source2: mailman-sendmail.m4
Source3: mailman-apache.conf
Source4: rc.mailman
Patch0: mailman.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040701, python
PreReq: OpenPKG, openpkg >= 20040701, python, MTA
AutoReq: no
AutoReqProv: no
%description
Mailman is software to help manage email discussion lists, much
like Majordomo and Smartmail. Unlike most similar products, Mailman
gives each mailing list a webpage, and allows users to subscribe,
unsubscribe, etc. over the Web. Even the list manager can administer
his or her list entirely from the Web. Mailman also integrates most
things people want to do with mailing lists, including archiving,
mail/news gateways, and so on.
%track
prog mailman = {
version = %{version}
url = ftp://ftp.gnu.org/gnu/mailman/
regex = mailman-(__VER__)\.tgz
}
%prep
%setup -q
%setup -q -D -T -a 1
%patch -p0
%build
# configure package
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
./configure \
--prefix=%{l_prefix}/libexec/mailman \
--exec-prefix=%{l_prefix}/libexec/mailman \
--sysconfdir=%{l_prefix}/etc/mailman \
--with-var-prefix=%{l_prefix}/var/mailman \
%if "%{with_username}" == "%{l_nusr}"
--with-username=%{l_nusr} \
%else
--with-username=%{with_username} \
%endif
%if "%{with_groupname}" == "%{l_ngrp}"
--with-groupname=%{l_ngrp} \
%else
--with-groupname=%{with_groupname} \
%endif
%if "%{cgigroup}" == "%{l_ngrp}"
--with-cgi-gid=%{l_ngrp} \
%else
--with-cgi-gid=%{cgigroup} \
%endif
%if "%{with_mail_gid}" == "%{l_mgrp}"
--with-mail-gid=%{l_mgrp} \
%else
--with-mail-gid=%{with_mail_gid} \
%endif
--with-cgi-ext="" \
--with-urlhost="localhost" \
--with-mailhost="localhost" \
--without-permcheck \
--enable-static
# build package
%{l_make} %{l_mflags}
%install
# install package
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT DIRSETGID=true
# create additional directories
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/mailman \
$RPM_BUILD_ROOT%{l_prefix}/man/man8
# install Sendmail mailer handler
%{l_shtool} install -c -m 755 \
-e 's;#!/usr/local/bin/perl;#!%{l_prefix}/bin/perl;' \
-e 's;/home/mailman/mail/mailman;%{l_prefix}/libexec/mailman/mail/mailman;' \
-e 's;/home/mailman/lists;%{l_prefix}/var/mailman/lists;' \
-e 's;/usr/lib/sendmail;%{l_prefix}/sbin/sendmail;' \
contrib/mm-handler \
$RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/mail/mailman-sendmail
# install Apache and Sendmail configurations
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE mailman-sendmail.m4} %{SOURCE mailman-apache.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/mailman/
# install manual pages
%{l_shtool} install -c -m 644 \
man8/*.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
# post-adjust default configuration
mv $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py \
$RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
ln -s %{l_prefix}/etc/mailman/mailman.cfg \
$RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py
( echo ""
echo "DEFAULT_EMAIL_HOST = 'host.example.com'"
echo "DEFAULT_URL_HOST = 'host.example.com'"
echo "IMAGE_LOGOS = '/mailman/icons/'"
echo "PUBLIC_ARCHIVE_URL = '/mailman/pipermail/%%(listname)s'"
echo "MAILMAN_USER = '%{with_username}'"
echo "MAILMAN_GROUP = '%{with_groupname}'"
echo "DEFAULT_SERVER_LANGUAGE = 'en'"
echo "VERP_PASSWORD_REMINDERS = 1"
echo "VERP_PERSONALIZED_DELIVERIES = 1"
echo "VERP_CONFIRMATIONS = 1"
echo "VERP_DELIVERY_INTERVAL = 1"
echo ""
echo "# For available options and their descriptions see:"
echo "# %{l_prefix}/libexec/mailman/Mailman/Defaults.py"
echo ""
) >>$RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.mailman} ${RPM_BUILD_ROOT}%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%dir %attr(2700,%{with_username},%{with_groupname}) %{l_prefix}/libexec/mailman/mail/mailman-sendmail' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/logs' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/spam' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/qfiles' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/locks' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/lists' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/archives' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/archives/*' \
'%dir %attr(2775,%{with_username},%{with_groupname}) %{l_prefix}/var/mailman/data' \
'%config %attr(0640,%{with_username},%{with_groupname}) %{l_prefix}/etc/mailman/mailman.cfg' \
'%config %{l_prefix}/etc/mailman/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
# add hook to MTA configuration
if [ $1 -eq 1 ]; then
aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_file`
update_command=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_update`
if [ ".$aliases_file" != . ]; then
( echo "mailman: postmaster"
echo "mailman-owner: postmaster"
) |\
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
fi
if [ ".$update_command" != . ]; then
eval $update_command
fi
fi
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
$RPM_INSTALL_PREFIX/libexec/mailman/bin/update
eval `%{l_rc} mailman status 2>/dev/null`
[ ".$mailman_active" = .yes ] && %{l_rc} mailman restart
exit 0
%preun
# before erase, stop service (and remove files)
[ $1 -eq 0 ] || exit 0
rm -f $RPM_INSTALL_PREFIX/libexec/mailman/bin/paths.pyc >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/libexec/mailman/cron/paths.pyc >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/libexec/mailman/scripts/paths.pyc >/dev/null 2>&1 || true
%{l_rc} mailman stop 2>/dev/null
exit 0
%postun
# remove hook from MTA configuration
[ $1 -eq 0 ] || exit 0
aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_file`
update_command=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_update`
if [ ".$aliases_file" != . ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
fi
if [ ".$update_command" != . ]; then
eval $update_command
fi