Accéder au contenu.
Menu Sympa

fr - Re: [sympa-fr] Sympa, creation de rpm et fichier spec

Objet : Pour les administrateurs de serveurs de listes utilisant le logiciel Sympa

Archives de la liste

Chronologique Discussions  
  • From: Mathieu Kretchner <adresse@cachée>
  • To: adresse@cachée
  • Cc: adresse@cachée
  • Subject: Re: [sympa-fr] Sympa, creation de rpm et fichier spec
  • Date: Wed, 09 Jul 2008 18:37:58 +0200

adresse@cachée a écrit :
Bonjour,

J'ai récupéré la dernière version de sympa, et j'ai voulu creer un rpm avec
le spec file fourni. J'ai fait les modification dans l'entete genre %define
spoo_s spool etc....mais lors du rpmbuild -ba j'ai systématiquement une erreur
comme quoi l'utilisateur sympa n'existe pas.... Normalement il devrait me le
creer à l'installation de sympa et ne devrait pas en avoir besoin a la
creation du RPM non ?

Y a t il une technique spéciale pour modifier le spec livré ?

Cordialement,
Eric PEYREMORTE


Voilà le .spec utilisé chez nous !
Surement améliorable, mais fonctionnel avec les répository qui vont bien.


# $Id: sympa.spec,v 1.63 2008/05/20 06:28:52 mkretchn Exp $
%define name sympa
%define version 5.4.3
%define release inria_semir_1.1
%define home_s /var/sympa
%define data_s /usr/share/sympa
%define conf_s /etc/sympa
%define etc_s /etc/sympa
%define spoo_s /var/sympa/spool

Summary:  Sympa is a powerful multilingual List Manager - LDAP and SQL features.
Name:  %{name}
Version:  %{version}
Release:  %{release}
License:  GPL
Group: System Environment/Daemons
Source:  http://www.sympa.org/distribution/%{name}-%{version}.tar.gz
URL: http://www.sympa.org
Requires: smtpdaemon
Requires: bash
Requires: shadow-utils
Requires: glibc >= 2.0
Requires: MHonArc >= 2.4.6
Requires: mod_fcgid
Requires: mod_ssl
Requires: mysql-server
Requires: openssl >= 0.9.5a
Requires: perl >= 0:5.005
Requires: perl-Archive-Zip
Requires: perl-CGI-Simple
Requires: perl-Crypt-CipherSaber
Requires: perl-DBD-MySQL
Requires: perl-DBI >= 1.06
Requires: perl-FCGI >= 0.48
Requires: perl-HTML-StripScripts-Parser
Requires: perl-IO-stringy >= 1.0
Requires: perl-LDAP >= 0.10
Requires: perl-libintl
Requires: perl-libwww-perl
Requires: perl-MailTools >= 1.14
Requires: perl-MIME-Charset 
Requires: perl-MIME-EncWords
Requires: perl-MIME-tools >= 5.209
Requires: perl-Net-SSLeay >= 1.21
Requires: perl-SOAP-Lite
Requires: perl-suidperl
Requires: perl-Template-Toolkit
Requires: perl-URI
Requires: perl-XML-LibXML
Requires: webserver
Prereq: /usr/sbin/useradd
Prereq: /usr/sbin/groupadd
Provides: perl(SympaTransport)
Provides: perl(parser.pl)
Provides: perl(tools.pl)
Provides: perl(tt2.pl)
BuildRoot: %{_tmppath}/%{name}-%{version}
BuildRequires: openssl-devel >= 0.9.5a
Prefix: %{_prefix}

%description

Sympa is scalable and highly customizable mailing list manager. 
It can cope with big lists (200,000 subscribers) and comes with
a complete (user and admin) Web interface. It is internationalized,
and supports the us, fr, de, es, it, fi, and chinese locales. 
A scripting language allows you to extend the behavior of commands.
Sympa can be linked to an LDAP directory or an RDBMS to create dynamic mailing lists.
Sympa provides S/MIME-based authentication and encryption.

%prep

rm -rf $RPM_BUILD_ROOT
%setup -q

%build

./configure \
--prefix=/var/sympa \
--enable-secure \
--with-confdir=/etc/sympa \
--with-etcdir=/etc/sympa \
--with-cgidir=/var/www/cgi-bin \
--with-bindir=/var/sympa/bin \
--with-sbindir=/var/sympa/sbin \
--with-mandir=%{_mandir} \
--with-libexecdir=/var/sympa/bin \
--with-libdir=/usr/lib/sympa/bin \
--with-datadir=/usr/share/sympa \
--with-expldir=/var/sympa/expl \
--with-piddir=/var/run/sympa \
--with-localedir=/usr/lib/sympa/locale \
--with-scriptdir=/var/sympa/bin \
--with-sampledir=/usr/share/sympa/examples \
--with-spooldir=/var/sympa/spool \
--with-openssl=/usr/bin/openssl \
;make sources soap_wrapper wrapper man locale


%install

rm -rf $RPM_BUILD_ROOT

# Create icons directory
mkdir -p /var/sympa/static_content/icons

make HOST=MYHOST DESTDIR=$RPM_BUILD_ROOT install

# Create bounce and archive directories
for dir in bounce wwsarchives wwsbounce ; do
  if [ ! -d $RPM_BUILD_ROOT%{spoo_s}/$dir ] ; then
    mkdir -p $RPM_BUILD_ROOT%{spoo_s}/$dir
    chown sympa $RPM_BUILD_ROOT%{spoo_s}/$dir
    chgrp sympa $RPM_BUILD_ROOT%{spoo_s}/$dir
    chmod 770 $RPM_BUILD_ROOT%{spoo_s}/$dir
  fi
done


%pre

# Create "sympa" group if it is not already there
#On teste l'existence du group sympa dans toutes les bases
if ! getent group | grep -q "^sympa:";
    echo "Adding system group: sympa."
    /usr/sbin/groupadd sympa
else
    echo "Group already exists"
fi

# Add "apache" in group "sympa" so that it could access
# /etc/sympa/wwsympa.conf and therefore a working wwsympa ;-)
if ! grep -q "^sympa:.*\<apache\>" /etc/group; then
    echo "Adding apache in group sympa."
    comma="";
    [ -n "$(grep '^sympa:' /etc/group | sed -e 's/^sympa:.*:.*://')" ] && comma=",";
    perl -pi -e "s/^(sympa:.*)/\1${comma}apache/" /etc/group
fi

# Create "sympa" user if it is not already there
home_s_pw=`sed -n -e "/^sympa:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/s//\1/p" /etc/passwd`
if [ -z "$home_s_pw" ]; then
    echo "Adding system user: sympa."
    /usr/sbin/useradd -M -g sympa -d %{home_s} sympa -c "Sympa mailing-list manager" -s "/bin/false"
elif [ "$home_s_pw" != "%{home_s}" ]; then
    echo "Problem: user \"sympa\" already exists with a home different from %{home_s}"
    exit 0
fi


%post

## Setting Runlevels
for I in 0 1 2 6; do
    mkdir -p $RPM_BUILD_ROOT/etc/rc.d/rc$I.d
    ln -s $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} $RPM_BUILD_ROOT/etc/rc.d/rc$I.d/K25%{name}
done
for I in 3 5; do
    mkdir -p $RPM_BUILD_ROOT/etc/rc.d/rc$I.d
    ln -s $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} $RPM_BUILD_ROOT/etc/rc.d/rc$I.d/S95%{name}
done

if [ -e "/var/log/sympa" ] && [ ! -f "/var/log/sympa" ]; then
    echo "Problem: /var/log/sympa already exists but it is not a file!"
fi
touch /var/log/sympa || /bin/true
chown sympa.sympa /var/log/sympa
chmod 0640 /var/log/sympa

# Setup log facility for Sympa
if [ -f /etc/syslog.conf ] ;then
    if [ `grep -c sympa /etc/syslog.conf` -eq 0 ] ;then
	typeset -i cntlog
	cntlog=0
#	while [ `grep -c local${cntlog} /etc/syslog.conf` -gt 0 ];do cntlog=${cntlog}+1;done	
	if [ ${cntlog} -le 9 ];then
	    echo "# added by %{name}-%{version} rpm $(date)" >> /etc/syslog.conf
	    echo "local${cntlog}.*       -/var/log/%{name}" >> /etc/syslog.conf
	fi
	perl -pi -e "s|^\*\.info;|\*\.info;local${cntlog}.none;|" /etc/syslog.conf
	for conffile in %{conf_s}/sympa.conf; do
	    perl -pi -e "s|syslog(\s+)LOCAL[0-9]+|syslog\1LOCAL${cntlog}|" $conffile
	done
    fi
fi

# rotate log for sympa
if [ -d /etc/logrotate.d ] ;then
    if [ ! -f /etc/logrotate.d/sympa ] ;then
	echo "/var/log/sympa {" > /etc/logrotate.d/sympa
	echo "    missingok" >> /etc/logrotate.d/sympa
	echo "    notifempty" >> /etc/logrotate.d/sympa
	echo "    copytruncate" >> /etc/logrotate.d/sympa
	echo "    rotate 10" >> /etc/logrotate.d/sympa
	echo "}" >> /etc/logrotate.d/sympa
    fi
fi

#the directory where sendmail can call queue and bouncequeue
bin_queue=/var/sympa/bin

# eventually, add queue and bouncequeue to sendmail security shell
if [ -d /etc/smrsh ]; then
  bin_queue=/etc/smrsh
  if [ ! -e /etc/smrsh/queue ]; then
    ln -s /var/sympa/bin/queue /etc/smrsh/queue
  fi
 
  if [ ! -e /etc/smrsh/bouncequeue ]; then
    ln -s /var/sympa/bin/bouncequeue /etc/smrsh/bouncequeue
  fi
fi

# config httpd for sympa /etc/httpd/conf.d/sympa.conf
install -d -m 755 /etc/httpd/conf.d
cat > /etc/httpd/conf.d/sympa.conf <<EOF
# added by %{name}-%{version} rpm $(date)
Alias /static-sympa %{_var}/sympa/static_content
ScriptAlias /sympa %{_var}/www/cgi-bin/wwsympa-wrapper.fcgi
#
# redirect en https
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://%{SERVER_NAME}/\$1 [R=permanent,L]
#
# redirect vers /sympa
<LocationMatch "^/+$">
RewriteEngine On
  RewriteRule ^(.*)$ /sympa [R=permanent,L]
</LocationMatch>
EOF


# Try to add some sample entries in /etc/aliases for sympa
for a_file in /etc/aliases /etc/postfix/aliases; do
    if [ -f ${a_file} ]; then
	if [ `grep -c sympa ${a_file}` -eq 0 ]; then
	    cp -f ${a_file} ${a_file}.rpmorig
	    echo >> ${a_file}
	    echo "# added by %{name}-%{version} rpm " $(date) >> ${a_file}
	    if [ `grep -c listmaster ${a_file}` -eq 0 ]; then
		echo "listmaster: \"|${bin_queue}/queue listmaster\"" >> ${a_file}
	    fi
	    echo "sympa: \"|${bin_queue}/queue sympa\"" >> ${a_file}
	    echo "bounce+*: \"|${bin_queue}/bouncequeue sympa\"" >> ${a_file}
	    echo "abuse-feedback-report: \"| /var/sympa/bin/bouncequeue sympa@${HOSTNAME}\"" >> ${a_file}
	    echo "sympa-request:  listmaster@${HOSTNAME}" >> ${a_file}
	    echo "sympa-owner:    listmaster@${HOSTNAME}" >> ${a_file}
	    echo "" >> ${a_file}
      # The user have to manually comment out the new aliases
      # and then invoke: /usr/bin/newaliases
	    echo "Your new aliases have been set up in ${a_file}. Please check them out before running /usr/bin/newaliases"
	    echo "You must configure your MTA (sendmail, postfix,...) for using a second aliases file, the one modified by sympa for his lists : /etc/mail/sympa_aliases"
	    echo "Refer to INSTALL file for more setup information..."
	fi
    fi
done

# create the alias file used by sympa for his lists
if [ ! -f "/etc/mail/sympa_aliases" ]; then
  if [ ! -d "/etc/mail" ]; then
      mkdir -p /etc/mail
  fi
  touch /etc/mail/sympa_aliases || /bin/true
  chown root.sympa /etc/mail/sympa_aliases
  chmod 0660 /etc/mail/sympa_aliases
fi

# aliases inclusion in postfix
mta="`readlink /etc/alternatives/mta 2>/dev/null | cut -d . -f 2`"
if [ "$mta" == "postfix" ]; then
    database=`/usr/sbin/postconf -h alias_database`
    maps=`/usr/sbin/postconf -h alias_maps`
    postconf -e \
        "alias_database = $database, hash:/etc/mail/sympa_aliases" \
        "alias_maps = $maps, hash:/etc/mail/sympa_aliases"
fi
/usr/bin/newaliases

# reset the default cookie
typeset -x secret
secret=`perl -e "print int(rand(time))"`
perl -pi -e "s|'cookie',\n|'cookie',|" /var/sympa/sbin/sympa_wizard.pl
perl -pi -e "s|'cookie',.*\n|'cookie', 'default' => '${secret}',\n|" /var/sympa/sbin/sympa_wizard.pl

# set Apache and MySQL runlevels
chkconfig httpd on
chkconfig mysqld on


%preun

# clean syslog
sed -i /sympa/d /etc/syslog.conf 

# clean logrotate
if [ ! -f /etc/logrotate.d/sympa ] ;then
    rm -f /etc/logrotate.d/sympa 
fi

# remove apache config
rm -f /etc/httpd/conf.d/sympa.conf

# remove aliases
mta="`readlink /etc/alternatives/mta 2>/dev/null | cut -d . -f 2`"
  if [ "$mta" == "postfix" ]; then
    database=`/usr/sbin/postconf -h alias_database | \
	sed -e 's|, hash:/etc/mail/sympa_aliases||'`
    maps=`/usr/sbin/postconf -h alias_maps | \
	sed -e 's|, hash:/etc/mail/sympa_aliases||'`
    postconf -e \
	"alias_database = $database" \
	"alias_maps = $maps"
    /usr/bin/newaliases
  fi
  
  rm -f /etc/mail/sympa_aliases*

# clean sympa dirs
rm -rf /var/sympa
rm -rf /usr/lib/sympa

# clean log
rm -f /var/log/sympa

  
%postun

# Remove sympa user and group
if [ ! -d %{home_s} ]; then
    /usr/sbin/userdel sympa
#Le groupe est contenu dans le NIS et ne peut pas être supprimé
   # /usr/sbin/groupdel sympa  
fi

# remove links in /etc/smrsh
if [ $1 = 0 -a -d /etc/smrsh ]; then
  if [ -L /etc/smrsh/queue ]; then
    rm -f /etc/smrsh/queue
  fi
  if [ -L /etc/smrsh/bouncequeue ]; then
    rm -f /etc/smrsh/bouncequeue
  fi

fi

# remove links in runlevels
if [ -L /etc/rc.d/rc?.d/??5sympa ]; then
rm `ls -1 /etc/rc.d/rc?.d/??5sympa`
fi

# clean sympa dirs
rm -rf /var/sympa
rm -rf /usr/lib/sympa

# clean log
rm -f /var/log/sympa


%files

# par default les fichiers sont a sympa:sympa
%defattr(-,sympa,sympa)

# Where to store the data & config files of the lists
%dir /var/sympa/expl

# Documentation
%doc %attr(-,root,root) INSTALL README AUTHORS COPYING NEWS ChangeLog
%doc %attr(-,root,root) doc/sympa.pdf
%doc %attr(-,root,root) /var/sympa/doc/*
%attr(-,root,root) %{_mandir}/man8/*
%{etc_s}/README

# Spools
%dir %{spoo_s}
%dir %{spoo_s}/msg
%dir %{spoo_s}/bounce
%dir %{spoo_s}/wwsarchives
%dir %{spoo_s}/wwsbounce
%dir %{spoo_s}/digest
%dir %{spoo_s}/moderation
%dir %{spoo_s}/expire
%dir %{spoo_s}/auth
%dir %{spoo_s}/outgoing
%dir %{spoo_s}/tmp
%dir %{spoo_s}/task

# Configuration files
%config(noreplace) %{conf_s}/sympa.conf
%config(noreplace) %{conf_s}/wwsympa.conf

# Config directories populated by the user
%dir %{etc_s}/create_list_templates
%dir %{etc_s}/scenari
%dir %{etc_s}/mail_tt2
%dir %{etc_s}/web_tt2
%dir %{etc_s}/general_task_models
%dir %{etc_s}/task_models

# Binaries
%attr(-,-,-) /usr/lib/sympa/bin
%attr(-,-,-) /var/sympa/sbin
%attr(-,-,-) /var/sympa/bin

# Variable directories
/usr/lib/sympa/locale
/usr/share/sympa
/var/sympa/arc

# Icons
/var/sympa/static_content

# Binaries for Apache
/var/www/cgi-bin/sympa_soap_server-wrapper.fcgi
/var/www/cgi-bin/sympa_soap_server.fcgi
/var/www/cgi-bin/wwsympa-wrapper.fcgi
/var/www/cgi-bin/wwsympa_sudo_wrapper.pl
/var/www/cgi-bin/wwsympa.fcgi

# Init scripts
#%config(noreplace) %attr(0755,root,root) /etc/rc.d/init.d/sympa
%attr(0755,root,root) /etc/rc.d/init.d/sympa


%clean

rm -rf $RPM_BUILD_ROOT

%changelog

* Thu May 8 2008 Olivier Dijoux <adresse@cachée>
- update to sympa 5.4.3

* Tue Apr 22 2008 Olivier Dijoux <adresse@cachée>
- update to sympa 5.4.2
- fix https redirect

* Fri Apr 11 2008 Mathieu Kretchner <adresse@cachée> , Olivier Dijoux <adresse@cachée>
- Initial Release RPM sympa 5.4.1

begin:vcard
fn:Mathieu Kretchner
n:Kretchner;Mathieu
org:INRIA;Syslog
adr;dom:;;2007 route des lucioles - BP93;Sophia Antipolis;;06902 CEDEX
email;internet:adresse@cachée
tel;work:04 92 38 76 67
x-mozilla-html:FALSE
version:2.1
end:vcard




Archives gérées par MHonArc 2.6.19+.

Haut de le page