You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
8.5 KiB
219 lines
8.5 KiB
## |
|
## mailman.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## 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. |
|
## |
|
|
|
# FIXME: rse: is this packaging complete? |
|
|
|
# package information |
|
Name: mailman |
|
Summary: Mailing List Management System |
|
URL: http://www.list.org/ |
|
Vendor: John Viega et al. |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: Mail |
|
License: GPL |
|
Version: 2.1.12 |
|
Release: 20090327 |
|
|
|
# list of sources |
|
Source0: http://download.sourceforge.net/mailman/mailman-%{version}.tgz |
|
Source1: manpages.tar.gz |
|
Source2: mailman-sendmail.m4 |
|
Source3: mailman-apache.conf |
|
Source4: rc.mailman |
|
Patch0: mailman.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, python |
|
PreReq: OpenPKG, openpkg >= 20160101, python, MTA |
|
|
|
%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 = http://sourceforge.net/projects/mailman/files/ |
|
regex = mailman-(\d+\.\d+\.\d+)\.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 \ |
|
--with-username=%{l_nusr} \ |
|
--with-groupname=%{l_mgrp} \ |
|
--with-cgi-gid=%{l_ngrp} \ |
|
--with-mail-gid=%{l_mgrp} \ |
|
--with-cgi-ext="" \ |
|
--with-urlhost="localhost" \ |
|
--with-mailhost="localhost" \ |
|
--without-permcheck \ |
|
--enable-static |
|
|
|
# build package |
|
%{l_make} %{l_mflags} |
|
|
|
%install |
|
# install package |
|
%{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 |
|
|
|
# strip down installation tree |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/tests |
|
|
|
# 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 = '%{l_nusr}'" |
|
echo "MAILMAN_GROUP = '%{l_mgrp}'" |
|
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,%{l_nusr},%{l_mgrp}) %{l_prefix}/libexec/mailman/mail/mailman-sendmail' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/logs' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/spam' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/qfiles' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/locks' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/lists' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives/*' \ |
|
'%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/data' \ |
|
'%config %attr(0640,%{l_nusr},%{l_mgrp}) %{l_prefix}/etc/mailman/mailman.cfg' \ |
|
'%config %{l_prefix}/etc/mailman/*' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
# add hook to MTA configuration |
|
if [ $1 -eq 1 ]; then |
|
aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file` |
|
update_command=`$RPM_INSTALL_PREFIX/bin/openpkg 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/bin/openpkg rc --query MTA_aliases_file` |
|
update_command=`$RPM_INSTALL_PREFIX/bin/openpkg 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 |
|
|
|
|