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.
 
 
 
 
 
 

338 lines
14 KiB

##
## sympa.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 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.
##
# package information
Name: sympa
Summary: Mailing List Manager
URL: http://www.sympa.org/
Vendor: CRU
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: Mail
License: GPL
Version: 5.4.1
Release: 20090418
# list of sources
Source0: http://www.sympa.org/distribution/sympa-%{version}.tar.gz
Source1: sympa-wrapper.c
Source2: sympa-setup.sh
Source3: sympa-apache.conf
Source4: rc.sympa
Patch0: sympa.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101
BuildPreReq: openssl, mhonarc
PreReq: openssl, mhonarc
BuildPreReq: perl-crypto, perl-mail, perl-util, perl-www, perl-comp
PreReq: perl-crypto, perl-mail, perl-util, perl-www, perl-comp
BuildPreReq: perl-locale, perl-parse, perl-sys, perl-ldap
PreReq: perl-locale, perl-parse, perl-sys, perl-ldap
BuildPreReq: perl-db, perl-dbi, perl-dbi::with_mysql = yes
PreReq: perl-db, perl-dbi, perl-dbi::with_mysql = yes
BuildPreReq: perl-xml, perl-xml::with_libxml = yes
PreReq: perl-xml, perl-xml::with_libxml = yes
PreReq: apache, apache-fastcgi = yes
PreReq: MTA
%description
Sympa is a rich open source mailing list software. Its design highly
focuses on customization possibilities and ease of administration.
Advanced features are: Bulk emailer, Internationalization, Service
messages and web pages defined by templates, Subscriber information
stored in a RDBMS, Web interface with user and admin features,
Different web authentication backends including Single Sign-on
systems, Web document repository for list members, S/MIME support
for both signature verification and mail encryption, Automatic
bounces management, External antiviral plugin, Virtual robots
management and SOAP ML service.
%track
prog sympa = {
version = %{version}
url = http://www.sympa.org/distribution/
regex = sympa-(\d+\.\d+(\.\d+)*)\.tar\.gz
}
%prep
%setup -q
%patch -p0
%build
# disable interactive checks
%{l_shtool} subst \
-e 's;warning checkperl checkcpan \(sources man locale\);\1;' \
Makefile.in
# disable ownership enforcements
%{l_shtool} subst \
-e 's;chown;true;' \
-e 's;chgrp;true;' \
Makefile.in */Makefile */*/Makefile
# configure program
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
./configure \
--prefix=%{l_prefix} \
--with-sbindir=%{l_prefix}/sbin \
--with-libexecdir=%{l_prefix}/libexec/sympa \
--with-cgidir=%{l_prefix}/libexec/sympa \
--with-confdir=%{l_prefix}/etc/sympa \
--with-iconsdir=%{l_prefix}/share/sympa/icons \
--with-datadir=%{l_prefix}/share/sympa \
--with-expldir=%{l_prefix}/var/sympa/expl \
--with-libdir=%{l_prefix}/lib/sympa \
--with-mandir=%{l_prefix}/man/man1 \
--with-docdir=%{l_prefix}/share/sympa/doc \
--with-initdir=%{l_prefix}/etc/sympa \
--with-lockdir=%{l_prefix}/var/sympa/run \
--with-piddir=%{l_prefix}/var/sympa/run \
--with-etcdir=%{l_prefix}/var/sympa/etc \
--with-localedir=%{l_prefix}/share/sympa/locale \
--with-scriptdir=%{l_prefix}/share/sympa/script \
--with-sampledir=%{l_prefix}/share/sympa/sample \
--with-spooldir=%{l_prefix}/var/sympa/spool \
--with-perl=%{l_prefix}/bin/perl \
--with-openssl=%{l_prefix}/bin/openssl \
--with-user=%{l_rusr} \
--with-group=%{l_rgrp} \
--with-sendmail_aliases=%{l_prefix}/var/sympa/mta/aliases \
--with-virtual_aliases=%{l_prefix}/var/sympa/mta/virtual \
--with-newaliases=`%{l_shtool} path -p %{l_prefix}/bin:%{l_prefix}/sbin newaliases` \
--with-postmap=%{l_prefix}/sbin/postmap \
--enable-secure
# build program
%{l_make} %{l_mflags}
# build setuid wrappers
%{l_cc} %{l_cflags -O} %{l_ldflags} \
'-DSCRIPT_PATH="%{l_prefix}/libexec/sympa/wwsympa.fcgi"' \
-o wwsympa.cgi %{SOURCE sympa-wrapper.c}
%{l_cc} %{l_cflags -O} %{l_ldflags} \
'-DSCRIPT_PATH="%{l_prefix}/libexec/sympa/sympa_soap_server.fcgi"' \
-o sympa_soap_server.cgi %{SOURCE sympa-wrapper.c}
%install
# install program
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
# post-adjust installation
%{l_shtool} subst \
-e 's;^#\(db_type\);\1;' \
-e 's;^#\(db_name\);\1;' \
-e 's;^#\(db_host\);\1;' \
-e 's;^#\(db_user\);\1;' \
-e 's;^#\(db_passwd\);\1;' \
$RPM_BUILD_ROOT%{l_prefix}/etc/sympa/sympa.conf
# strip down installation
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/sympa/sympa
chmod a-s $RPM_BUILD_ROOT%{l_prefix}/libexec/sympa/*.fcgi
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
# install setuid wrappers
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/cgi
%{l_shtool} install -c -s -m 755 \
wwsympa.cgi sympa_soap_server.cgi \
$RPM_BUILD_ROOT%{l_prefix}/cgi/
# install setup script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE sympa-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/sympa-setup
# install Apache configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE sympa-apache.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/sympa/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.sympa} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# create additional directories (Sympa missing)
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/spool/bounce \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/spool/subscribe \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/spool/distribute \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/spool/distribute/bad \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/spool/msg/bad
# create additional directories (OpenPKG specific)
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/store/arc \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/store/bounce \
$RPM_BUILD_ROOT%{l_prefix}/var/sympa/mta
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/sympa/*' \
'%attr(6755,%{l_rusr},%{l_rgrp}) %{l_prefix}/bin/bouncequeue' \
'%attr(6755,%{l_rusr},%{l_rgrp}) %{l_prefix}/bin/queue' \
'%attr(6755,%{l_rusr},%{l_rgrp}) %{l_prefix}/cgi/wwsympa.cgi' \
'%attr(6755,%{l_rusr},%{l_rgrp}) %{l_prefix}/cgi/sympa_soap_server.cgi' \
'%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sympa/aliaswrapper' \
'%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sympa/virtualwrapper' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/sympa' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/sympa/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/sympa/*/*' \
'%attr(-,%{l_susr},%{l_rgrp}) %{l_prefix}/var/sympa/mta' \
'%doc %{l_prefix}/share/sympa/doc/*/html' \
'%doc %{l_prefix}/share/sympa/doc/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROO
%post
if [ $1 -eq 1 ]; then
# add hook to Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
( echo "Include $RPM_INSTALL_PREFIX/etc/sympa/sympa-apache.conf"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:sympa" $apacheconf
fi
# establish initial Sympa MTA glue files
touch $RPM_INSTALL_PREFIX/var/sympa/mta/aliases
touch $RPM_INSTALL_PREFIX/var/sympa/mta/virtual
chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/sympa/mta/*
# hook into MTA
mta_name=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_name`
mta_aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
mta_update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
if [ ".$mta_aliases_file" != . ]; then
( echo "# Sympa Static Aliases"
echo "listmaster: \"|$RPM_INSTALL_PREFIX/bin/queue listmaster\""
echo "sympa: \"|$RPM_INSTALL_PREFIX/bin/queue sympa\""
echo "bounce+*: \"|$RPM_INSTALL_PREFIX/bin/bouncequeue sympa\""
echo "sympa-request: postmaster"
echo "sympa-owner: postmaster"
) |\
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:sympa" $mta_aliases_file
fi
if [ ".$mta_update_command" != . ]; then
eval $mta_update_command >/dev/null 2>&1 || true
fi
case "$mta_name" in
sendmail )
( echo "dnl # Sympa Dynamic Aliases"
echo "define(\`ALIAS_FILE', ALIAS_FILE\`,$RPM_INSTALL_PREFIX/var/sympa/mta/aliases')"
) |\
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:sympa" -p "dnl " $RPM_INSTALL_PREFIX/etc/sendmail/sendmail.m4
(cd $RPM_INSTALL_PREFIX/etc/sendmail && make) >/dev/null 2>&1 || true
;;
postfix )
%{l_shtool} subst -b .orig \
-e "s;^\\(alias_maps[^=]*=.*\\);\\1, hash:$RPM_INSTALL_PREFIX/var/sympa/mta/aliases;" \
-e "s;^\\(alias_database[^=]*=.*\\);\\1, hash:$RPM_INSTALL_PREFIX/var/sympa/mta/aliases;" \
$RPM_INSTALL_PREFIX/etc/postfix/main.cf
(cd $RPM_INSTALL_PREFIX/etc/postfix && make) >/dev/null 2>&1 || true
;;
esac
# display final hints on initial installation
( echo "To complete this installation of Sympa please perform:"
echo "1. optionally set a fresh random password for the Sympa"
echo " database by editing the \"db_password\", \"listmaster\""
echo " and \"domain\" entries in the configuration file:"
echo " \$ vi $RPM_INSTALL_PREFIX/etc/sympa/sympa.conf"
echo "2. start MySQL and initialize the Sympa database with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
echo " \$ $RPM_INSTALL_PREFIX/sbin/sympa-setup install"
echo "3. start Apache and the Sympa daemons with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc apache start"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc sympa start"
echo "4. connect with a browser to Sympa for further configuration:"
echo " http://127.0.0.1/sympa/"
echo "5. login with \"listmaster\" for Sympa administrative access."
) | %{l_rpmtool} msg -b -t notice
fi
if [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} sympa status 2>/dev/null`
[ ".$sympa_active" = .yes ] && %{l_rc} sympa restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# remove hook from Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:sympa" $apacheconf
fi
# unhook from MTA
mta_name=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_name`
mta_aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
mta_update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
if [ ".$mta_aliases_file" != . ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:sympa" $mta_aliases_file
fi
if [ ".$mta_update_command" != . ]; then
eval $mta_update_command >/dev/null 2>&1 || true
fi
case "$mta_name" in
sendmail )
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:sympa" -p "dnl " $RPM_INSTALL_PREFIX/etc/sendmail/sendmail.m4
(cd $RPM_INSTALL_PREFIX/etc/sendmail && make) >/dev/null 2>&1 || true
;;
postfix )
%{l_shtool} subst -b .orig \
-e "s;^\\(alias_maps[^=]*=.*\\), hash:$RPM_INSTALL_PREFIX/var/sympa/mta/aliases;\\1;" \
-e "s;^\\(alias_database[^=]*=.*\\), hash:$RPM_INSTALL_PREFIX/var/sympa/mta/aliases;\\1;" \
$RPM_INSTALL_PREFIX/etc/postfix/main.cf
(cd $RPM_INSTALL_PREFIX/etc/postfix && make) >/dev/null 2>&1 || true
;;
esac
# before erase, stop service and remove log files
%{l_rc} sympa stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/sympa/run/*.pid >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/sympa/run/sympa.log >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/sympa/spool/*/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/sympa/mta/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/sympa/expl/* >/dev/null 2>&1 || true
$RPM_INSTALL_PREFIX/sbin/sympa-setup uninstall >/dev/null 2>&1 || true
fi
exit 0