Sophie

Sophie

distrib > Arklinux > devel > i586 > by-pkgid > b6845137061d504597253e7233481a4e > files > 14

mailman-2.1.8-1ark.src.rpm

Summary: Mailing list manager with built in Web access.
Name: mailman
Version: 2.1.8
Release: 1ark
Group: Applications/Internet
#Source0: ftp://ftp.gnu.org/pub/gnu/mailman/mailman-%{version}.tgz
Source0: http://prdownloads.sourceforge.net/mailman/mailman-%{version}.tar.bz2
Source1: mm_cfg.py
Source3: httpd-mailman.conf
Source4: mailman.logrotate
Source5: mailman.INSTALL.REDHAT.in
Source6: mailman-crontab-edit
Source7: mailman-migrate-fhs
Patch1: mailman-2.1-multimail.patch
Patch2: mailman-2.1-build.patch
Patch3: mailman-2.1-mailmanctl-status.patch
Patch4: mailman-cron.patch
Patch5: mailman-FHS.patch
Patch6: mailman-python-compile.patch
Patch7: mailman-init.patch

License: GPL
URL: http://www.list.org/
BuildRoot: %{_tmppath}/%{name}-root
Prereq: shadow-utils, /sbin/chkconfig, /sbin/service
Requires: fcron, httpd, python >= 2.2, mktemp
BuildRequires: python-devel >= 2.2, automake
Requires(post,postun): fcron

%define contentdir /srv/www

# Installation directories
%define mmdir /usr/lib/%{name}
%define varmmdir /var/lib/%{name}
%define docdir /usr/share/doc/%{name}-%{version}
%define configdir /etc/%{name}
%define datadir %{varmmdir}/data
%define lockdir /var/lock/%{name}
%define logdir /var/log/%{name}
%define piddir /var/run/%{name}
%define queuedir /var/spool/%{name}
%define httpdconfdir /etc/httpd/conf.d
%define restart_flag /var/run/%{name}-restart-after-rpm-install
%define mmbuilddir %{_builddir}/%{name}-%{version}

%define httpdconffile %{name}.conf

# Now, the user and group the CGIs will expect to be run under.  This should
# match the user and group the web server is configured to run as.  The scripts
# will error out if they are invoked by any other user.
%define cgiuser    apache
%define cgigroup   apache

# Now, the user and group the scripts will actually execute as.
%define mmuser       mailman
%define mmuserid     41
%define mmgroup      mailman
%define mmgroupid    41

# Directory/File modes & permissions
%define dirmode 2775
%define exemode 2755

%define mailgroup  postfix

# The mail wrapper program
%define mail_wrapper mailman

%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.

Documentation can be found in: %{docdir}

When the package has finished installing, you will need to perform some
additional installation steps, these are described in:
%{docdir}/INSTALL.REDHAT

%prep
%setup -q
%patch1 -p1 -b .multimail~
%patch2 -p1 -b .permissions~
%patch3 -p1 -b .status~
%patch4 -p1 -b .cron~
%patch5 -p1 -b .FHS~
%patch6 -p1 -b .python-compile~
%patch7 -p1 -b .inithelp~

cp $RPM_SOURCE_DIR/mailman.INSTALL.REDHAT.in INSTALL.REDHAT.in

%build

CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
rm -f ./configure
aclocal
autoconf
./configure \
	--prefix=%{mmdir} \
	--with-var-prefix=%{varmmdir} \
	--with-config-dir=%{configdir} \
	--with-lock-dir=%{lockdir} \
	--with-log-dir=%{logdir} \
	--with-pid-dir=%{piddir} \
	--with-queue-dir=%{queuedir} \
	--with-python=%{__python} \
	--with-mail-gid=%{mailgroup} \
	--with-cgi-id=%{cgiuser} \
	--with-cgi-gid=%{cgigroup} \
	--with-mailhost=localhost.localdomain \
	--with-urlhost=localhost.localdomain \
	--without-permcheck

function SubstituteParameters()
{
sed -e 's|@VAR_PREFIX@|%{varmmdir}|g' \
    -e 's|@VARMMDIR@|%{varmmdir}|g' \
    -e 's|@prefix@|%{mmdir}|g' \
    -e 's|@MMDIR@|%{mmdir}|g' \
    -e 's|@CONFIG_DIR@|%{configdir}|g' \
    -e 's|@DATA_DIR@|%{datadir}|g' \
    -e 's|@LOCK_DIR@|%{lockdir}|g' \
    -e 's|@LOG_DIR@|%{logdir}|g' \
    -e 's|@PID_DIR@|%{piddir}|g' \
    -e 's|@QUEUE_DIR@|%{queuedir}|g' \
    -e 's|@DOC_DIR@|%{docdir}|g' \
    -e 's|@HTTPD_CONF_DIR@|%{httpdconfdir}|g' \
    -e 's|@HTTPD_CONF_FILE@|%{httpdconffile}|g' \
    $1 > $2
}

SubstituteParameters "INSTALL.REDHAT.in" "INSTALL.REDHAT"
SubstituteParameters "%{SOURCE1}" "Mailman/mm_cfg.py.dist"
SubstituteParameters "%{SOURCE3}" "httpd-mailman.conf"
SubstituteParameters "%{SOURCE4}" "mailman.logrotate"

make
	
%install
rm -fr $RPM_BUILD_ROOT
# Normal install.
make DESTDIR=$RPM_BUILD_ROOT install
#make install prefix=$RPM_BUILD_ROOT%{mmdir} var_prefix=$RPM_BUILD_ROOT%{varmmdir}

# Install the mailman init.d script
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
install $RPM_BUILD_ROOT%{mmdir}/scripts/mailman $RPM_BUILD_ROOT/etc/rc.d/init.d/mailman

# Install the mailman cron.d script
mkdir -p $RPM_BUILD_ROOT/etc/cron.d
cat > $RPM_BUILD_ROOT/etc/cron.d/%{name} <<EOF
# DO NOT EDIT THIS FILE!
#
# Contents of this file managed by /etc/init.d/%{name}
# Master copy is %{mmdir}/cron/crontab.in
# Consult that file for documentation
EOF

# Copy the icons into the web server's icons directory.
mkdir -p $RPM_BUILD_ROOT%{contentdir}/icons
cp $RPM_BUILD_ROOT/%{mmdir}/icons/* $RPM_BUILD_ROOT%{contentdir}/icons

# Create a link to the wrapper in /etc/smrsh to allow sendmail to run it.
mkdir -p $RPM_BUILD_ROOT/etc/smrsh
ln -s %{mmdir}/mail/%{mail_wrapper} $RPM_BUILD_ROOT/etc/smrsh

# Create a link so that the config file mm_cfg.py appears in config
# directory /etc/mailman. We don't put mm_cfg.py in the config directory
# because its executable code (python file) and the security policy wants
# to keep executable code out of /etc and inside of a lib directory instead,
# and because traditionally mm_cfg.py was in the Mailman subdirectory and
# experienced mailman admins will expect to find it there. But having it 
# "appear" in the config directory is good practice and heading in the 
# right direction for FHS compliance.
mkdir -p $RPM_BUILD_ROOT%{configdir}
ln -s %{mmdir}/Mailman/mm_cfg.py $RPM_BUILD_ROOT%{configdir}

# sitelist.cfg used to live in the DATA_DIR, now as part of the 
# FHS reoraganization it lives in the CONFIG_DIR. Most of the
# documentation refers to it in its DATA_DIR location and experienced
# admins will expect to find it there, so create a link in DATA_DIR to
# point to it in CONFIG_DIR so people aren't confused.
ln -s %{configdir}/sitelist.cfg $RPM_BUILD_ROOT%{datadir}

# Install a logrotate control file.
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m644 %{mmbuilddir}/mailman.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/%{name}

# Install the httpd configuration file.
install -m755 -d $RPM_BUILD_ROOT%{httpdconfdir}
install -m644 %{mmbuilddir}/httpd-mailman.conf $RPM_BUILD_ROOT%{httpdconfdir}/%{httpdconffile}

# Install the documentation files
install -m755 -d $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/INSTALL.REDHAT   $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/ACKNOWLEDGMENTS  $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/FAQ              $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/NEWS             $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/README           $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/README.CONTRIB   $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/README-I18N.en   $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/README.NETSCAPE  $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/README.USERAGENT $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/STYLEGUIDE.txt   $RPM_BUILD_ROOT%{docdir}
install -m644 %{mmbuilddir}/UPGRADING        $RPM_BUILD_ROOT%{docdir}

cp -r %{mmbuilddir}/contrib $RPM_BUILD_ROOT%{docdir}
install -m644 $RPM_SOURCE_DIR/mailman-migrate-fhs $RPM_BUILD_ROOT%{docdir}/contrib/migrate-fhs
install -m755 -d $RPM_BUILD_ROOT%{docdir}/admin
cp -r %{mmbuilddir}/admin/www $RPM_BUILD_ROOT%{docdir}/admin

# remove dir/files from $RPM_BUILD_ROOT that we aren't shipping
rm -rf $RPM_BUILD_ROOT%{varmmdir}/icons

# The file fblast confuses /usr/lib/rpm/find-requires because its an executable
# script file that does not have the interpreter as the first line, its not
# executable by itself so turn off its execute permissions
chmod 0644 $RPM_BUILD_ROOT/%{mmdir}/tests/fblast.py

%clean
rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.%{name}

%pre

# Make sure the user "mailman" exists on this system and has the correct values
if grep -q "^mailman:" /etc/group 2> /dev/null ; then
  /usr/sbin/groupmod -g %{mmgroupid} -n %{mmgroup} %{mmgroup} 2> /dev/null || :
else
  /usr/sbin/groupadd -g %{mmgroupid} %{mmgroup} 2> /dev/null || :
fi
if grep -q "^mailman:" /etc/passwd 2> /dev/null ; then
  /usr/sbin/usermod -s /sbin/nologin -c "GNU Mailing List Manager" -d %{mmdir} -u %{mmuserid} -g %{mmgroupid}       %{mmuser} 2> /dev/null || :
else
  /usr/sbin/useradd -s /sbin/nologin -c "GNU Mailing List Manager" -d %{mmdir} -u %{mmuserid} -g %{mmgroupid} -M -r %{mmuser} 2> /dev/null || :
fi

# Mailman should never be running during an install, but a package upgrade
# shouldn't silently stop the service, so if mailman was running
# we'll leave a temp file in the lock directory as a flag so in
# the post install phase we can restart it.
if [ -d %{lockdir} ]; then
  rm -f %{restart_flag}
  /sbin/service %{name} status >/dev/null 2>&1
  if [ $? -eq 0 ]; then
      touch %{restart_flag}
      /sbin/service %{name} stop >/dev/null 2>&1
  fi
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

%post
# This adds the proper /etc/rc*.d links for the script that runs the mailman qrunner daemon
chkconfig --add mailman

# Restart mailman if it had been running before installation
if [ -e %{restart_flag} ]; then
  rm %{restart_flag}
  /sbin/service %{name} start >/dev/null 2>&1
fi

# Sync crontabs
%_sbindir/check_system_crontabs

# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

%postun
# Sync crontabs
%_sbindir/check_system_crontabs
exit 0

%preun

# if [ $1 = 0 ]' checks that this is the actual deinstallation of
# the package, as opposed to just removing the old package on upgrade.

if [ $1 = 0 ]; then
  # These statements stop the service, and remove the /etc/rc*.d links.
  /sbin/service %{name} stop >/dev/null 2>&1
  /sbin/chkconfig --del %{name}
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

%files
%defattr(-,root,%{mmgroup})
%dir %{mmdir}
%{mmdir}/Mailman
%{mmdir}/bin
%{mmdir}/cgi-bin
%{mmdir}/cron
%{mmdir}/icons
%{mmdir}/mail
%{mmdir}/messages
%{mmdir}/pythonlib
%{mmdir}/scripts
%config(noreplace) %{mmdir}/templates
%{mmdir}/tests
%{varmmdir}
%doc %{docdir}
%attr(0755,root,root) %{contentdir}/icons
%attr(0644, root, %{mmgroup}) %config(noreplace) %verify(not md5 size mtime) %{mmdir}/Mailman/mm_cfg.py
%config(noreplace) %{httpdconfdir}/%{httpdconffile}
/etc/logrotate.d/%{name}
/etc/smrsh/%{mail_wrapper}
%attr(2775,root,%{mmgroup}) %{configdir}
%attr(0644, root, %{mmgroup}) %config(noreplace) %verify(not md5 size mtime) %{configdir}/sitelist.cfg
%attr(2775,root,%{mmgroup}) %{lockdir}
%attr(2775,root,%{mmgroup}) %{logdir}
%attr(2775,root,%{mmgroup}) %{queuedir}
%attr(2775,root,%{mmgroup}) %{piddir}
%attr(0755,root,root) /etc/rc.d/init.d/%{name}
%attr(0644,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/cron.d/mailman
%attr(0644,root,%{mmgroup}) %config(noreplace) %{mmdir}/cron/crontab.in

%changelog
* Mon Aug 14 2006 Bernhard Rosenkraenzer <bero@arklinux.org> 2.1.8-1ark
- Initial Ark package, partially borrowed from Fedora