%define name sympa %define version 3.2.1 %define release 5mdk %define data_s %{_datadir}/sympa %define conf_s %{_sysconfdir}/sympa %define home_s %{_localstatedir}/sympa %define home_a /var/www Summary: SYMPA is an electronic mailing list manager Name: %{name} Version: %{version} Release: %{release} License: GPL Group: System/Servers Source: http://listes.cru.fr/sympa/distribution/%{name}-%{version}.tar.bz2 # (gb) added correctly exported vars (PIDDIR, SPOOLDIR) while subst-creating /etc/[ww]sympa.conf Patch0: %{name}-3.2.1-var_subst.patch.bz2 Patch1: %{name}-3.2.1-use_digest_md5.patch.bz2 Patch2: sympa-3.2.1-gprintify.patch.bz2 URL: http://listes.cru.fr/sympa/ # Sendmail or Postfix Requires: MailTransportAgent Requires: perl Requires: perl-MailTools >= 1.14 Requires: perl-MIME-Base64 >= 1.0 Requires: perl-IO-stringy >= 1.0 Requires: perl-Msgcat >= 1.03 Requires: perl-MIME-tools >= 5.209 Requires: perl-CGI >= 2.52 Requires: perl-DBI >= 1.06 Requires: perl-DB_File >= 1.73-5mdk ## Also requires a DBD for the DBMS ## (perl-DBD-Pg or Perl-Msql) Requires: perl-ldap >= 0.10 Requires: perl-FCGI >= 0.48 Requires: perl-Digest-MD5 Requires: openssl >= 0.9.5a BuildRequires: perl BuildRequires: openssl-devel >= 0.9.5a PreReq: /usr/sbin/groupadd PreReq: /usr/sbin/useradd BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot # WWSympa requirements Requires: MHonArc >= 2.4.5 Requires: apache BuildRequires: apache %description SYMPA is an electronic mailing list manager. It is used to automate list management functions such as subscription, moderation and management of archives. SYMPA also manages sending of messages to the lists, and makes it possible to reduce the load on the system. Provided that you have enough memory on your system, Sympa is especially well adapted for big lists. For a list with 20 000 subscribers, it takes 5 minutes to send a message to 90% of subscribers, of course considering that the network is available. Documentation is available under HTML and SGML (source) formats. %prep rm -rf $RPM_BUILD_ROOT %setup -q %patch0 -p1 -b .var_subst %patch1 -p1 -b .digest_md5 %patch2 -p1 -b .gprintify %build %serverbuild # Fix Apache home dir for f in `find . -type f -exec grep -l "\/home\/httpd" {} \;`; do perl -pi -e "s|\/home\/httpd|%{home_a}|" $f done # NOTE: the PIDDIR directory will be created by hand in %install %make sources languages CONFDIR=%{conf_s} %install rm -rf $RPM_BUILD_ROOT # We can't chown/chgrp here. Fix it later (%files). for i in ./src/Makefile ./wwsympa/Makefile ./src/etc/sample/Makefile ./Makefile; do perl -pi -e "s|chown|/bin/true|" $i perl -pi -e "s|chgrp|/bin/true|" $i done # Actually chmod the files but not the directory! perl -pi -e "s|chmod -R 644(.+wws_templates)|chmod 644 \1/*|" ./wwsympa/Makefile ## ## Install Sympa ## make installsrc \ DESTDIR=$RPM_BUILD_ROOT DIR=%{_libdir}/sympa \ ETCBINDIR=%{_datadir}/sympa CONFDIR=%{conf_s} \ SENDMAIL_ALIASES=/etc/aliases # Correct permissions on file in %{_libdir}/sympa chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/*.pm chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/tools.pl chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/parser.pl chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/msg.pl # Installation of catalogs make installnls \ DESTDIR=$RPM_BUILD_ROOT DIR=%{_libdir}/sympa \ NLSDIR=%{_libdir}/sympa/nls cp nls/*.msg $RPM_BUILD_ROOT%{_libdir}/sympa/nls chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/nls/*.msg chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/nls/*.cat # Install man pages make installman DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} chmod 0644 $RPM_BUILD_ROOT%{_mandir}/man8/*.8 # Install examples make installsample DESTDIR=$RPM_BUILD_ROOT DIR=%{_datadir}/sympa/examples rm -f $RPM_BUILD_ROOT%{_datadir}/sympa/examples/sample/*.conf chmod 0644 $RPM_BUILD_ROOT%{_datadir}/sympa/ca-bundle.crt chmod 0644 $RPM_BUILD_ROOT%{_datadir}/sympa/mhonarc-ressources ## ## Install WWSympa ## make installwws \ DESTDIR=$RPM_BUILD_ROOT DIR=%{_libdir}/sympa \ ETCBINDIR=%{_datadir}/sympa CONFDIR=%{conf_s} \ WWSBINDIR=%{home_a}/cgi-bin \ ICONSDIR=%{home_a}/icons/sympa # Remove the useless mimie.types file rm -f $RPM_BUILD_ROOT%{home_a}/cgi-bin/mime.types # Correct permission on file in %{_libdir}/sympa chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/*.pm chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/Marc/*.pm chmod 0644 $RPM_BUILD_ROOT%{_libdir}/sympa/bin/*-lib.pl ## ## Install config files and misc ## # Host name is patched at install time make installconfig \ DESTDIR=$RPM_BUILD_ROOT DIR=%{home_s} \ ETCBINDIR=%{conf_s}/sympa CONFDIR=%{conf_s} \ PIDDIR=/var/run/sympa \ SPOOLDIR=/var/spool/sympa \ NLSDIR=%{_libdir}/sympa/nls \ ICONSDIR=%{home_a}/icons/sympa \ HOST=MY_HOST chmod 0644 $RPM_BUILD_ROOT%{conf_s}/sympa.conf chmod 0644 $RPM_BUILD_ROOT%{conf_s}/wwsympa.conf # Populate config directory for dir in create_list_templates scenari wws_templates templates; do mkdir -p $RPM_BUILD_ROOT%{conf_s}/$dir done # Copy to examples directory mkdir -p $RPM_BUILD_ROOT%{_datadir}/sympa/examples/config (cd $RPM_BUILD_ROOT%{_datadir}/sympa/examples/config; cp -p $RPM_BUILD_ROOT%{conf_s}/sympa.conf . cp -p $RPM_BUILD_ROOT%{conf_s}/wwsympa.conf . ) # Create a directory for Sympa PIDs mkdir -p $RPM_BUILD_ROOT/var/run/sympa # Install misc scripts make installscript \ DESTDIR=$RPM_BUILD_ROOT CONFDIR=%{conf_s} \ DIR=%{_libdir}/sympa INITDIR=%{_initrddir} \ SCRIPTDIR=%{_datadir}/sympa/examples/script # Move DB scripts to examples/db mkdir -p $RPM_BUILD_ROOT%{_datadir}/sympa/examples/db mv $RPM_BUILD_ROOT%{_datadir}/sympa/examples/script/create_db.* \ $RPM_BUILD_ROOT%{_datadir}/sympa/examples/db/ # Create Sympa home dir and spools mkdir -p $RPM_BUILD_ROOT%{home_s}/expl for dir in msg bounce wwsarchive wwsbounce; do mkdir -p $RPM_BUILD_ROOT/var/spool/sympa/$dir done #echo "See README and INSTALL in %{_docdir}/%{name}-%{version}" > $RPM_BUILD_ROOT%{home_s}/README.first %pre # Create "sympa" group if it is not already there if ! grep -q "^sympa:" /etc/group; then echo "Adding system group: sympa." /usr/sbin/groupadd sympa 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 -u 89 -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 %_post_service sympa # Install sympa.conf if [ ! -f "%{conf_s}/sympa.conf" ]; then cp %{_datadir}/sympa/examples/config/sympa.conf %{conf_s}/sympa.conf fi # Add new parameters if ! grep -q "^[:space:]*spool[:space:]\+" %{conf_s}/sympa.conf; then echo -e "\n## Parent directory containing all spools\n" >> %{conf_s}/sympa.conf echo -e "spool\t\t/var/spool/sympa\n" >> %{conf_s}/sympa.conf fi if ! grep -q "^[:space:]*spool[:space:]\+" %{conf_s}/sympa.conf; then echo -e "\n## Temporary directory\n" >> %{conf_s}/sympa.conf echo -e "tmpdir\t\t/var/spool/sympa\n" >> %{conf_s}/sympa.conf fi # Setup a correct hostname perl -pi -e "s|MY_HOST|${HOSTNAME}|g" %{conf_s}/sympa.conf # Ensure permissions and ownerships are right chown -R root.root %{_libdir}/sympa chown -R sympa.sympa /var/spool/sympa chmod -R ug=rwX,o=X /var/spool/sympa chown -R sympa.sympa /var/run/sympa chown -R sympa.sympa %{conf_s}/* chmod 0640 %{conf_s}/sympa.conf if [ -e "/var/log/sympa" ] && [ ! -f "/var/log/sympa" ]; then echo "Problem: /var/log/sympa.log 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 chown sympa.sympa %{_libdir}/sympa/bin/queue chown sympa.sympa %{_libdir}/sympa/bin/bouncequeue # Get rid of the old /etc/sympa/config directory if [ -d "/etc/sympa/config" ]; then rm -f /etc/sympa/config/helpfile rm -f /etc/sympa/config/helpfile.advanced rm -f /etc/sympa/config/lists rmdir /etc/sympa/config || true fi # Try to add some sample entries in /etc/aliases for sympa # TODO: handle updates from sympa 2.x entries to sympa 3.x entries ? # (sympa, listmaster, bounce+*, sympa-request, sympa-owner) 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: root" >> ${a_file} fi echo "# sympa: \"|%{home_s}/bin/queue 0 sympa\"" >> ${a_file} echo "# sympa-request: listmaster@${HOSTNAME}" >> ${a_file} echo "# sympa-owner: listmaster@${HOSTNAME}" >> ${a_file} echo "" >> ${a_file} # (gb) 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" else # Possibly fix up bad paths in aliases file perl -pi -e "s|/var/lib/sympa/bin/queue|%{_libdir}/sympa/bin/queue|" ${a_file} /usr/bin/newaliases fi fi done # 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 fi fi # Fix syslog variable for the correct subsystem to use in config files cntlog=`sed -n -e "/^local.*sympa/s|^local\([0-9][0-9]*\)\.\*[ \t]*/var/log/sympa|\1|p" < /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 # Eventually, add queue to sendmail security shell if [ -d /etc/smrsh ]; then if [ ! -e /etc/smrsh/queue ]; then ln -s %{home_s}/bin/queue /etc/smrsh/queue fi fi ## ## WWSympa postinstall ## # Install wwsympa.conf if [ ! -f "%{conf_s}/wwsympa.conf" ]; then cp %{_datadir}/sympa/examples/wwsympa.conf %{conf_s}/wwsympa.conf fi # Setup a correct hostname perl -pi -e "s|MY_HOST|${HOSTNAME}|g" %{conf_s}/wwsympa.conf # Ensure permissions are correctly set for wwsympa.conf chmod 0640 %{conf_s}/wwsympa.conf # 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 fi fi # Fix syslog variable for the correct subsystem to use in config files cntlog=`sed -n -e "/^local.*sympa/s|^local\([0-9][0-9]*\)\.\*[ \t]*/var/log/sympa|\1|p" < /etc/syslog.conf` for conffile in %{conf_s}/wwsympa.conf; do perl -pi -e "s|syslog(\s+)LOCAL[0-9]+|syslog\1LOCAL${cntlog}|" $conffile done %preun %_preun_service sympa %postun #if [ $1 = 0 ]; then # if [ -d "%{home_s}" ]; then # rm -rf %{home_s}/* # fi #fi if [ ! -d "%{home_s}" ]; then /usr/sbin/userdel -r sympa /usr/sbin/groupdel sympa fi if [ $1 = 0 -a -d /etc/smrsh ]; then if [ -L /etc/smrsh/queue ]; then rm -f /etc/smrsh/queue fi fi ## ## Sympa file list ## %files %defattr(-,sympa,sympa) # Home directory %dir %{home_s} %dir %{home_s}/expl # Documentation %defattr(-,root,root) %doc INSTALL LICENSE README RELEASE_NOTES %doc doc/sympa doc/sympa.ps %{_mandir}/man8/* # Spools %dir /var/spool/sympa %dir /var/spool/sympa/msg %dir /var/spool/sympa/bounce # PID directory %dir /var/run/sympa # Config file, permissions are reset in %post as (0640,sympa,sympa) %dir %{conf_s} %config(noreplace) %{conf_s}/sympa.conf # Config directories populated by the user %dir %{conf_s}/create_list_templates %dir %{conf_s}/scenari %dir %{conf_s}/templates # Binaries %dir %{_libdir}/sympa %dir %{_libdir}/sympa/bin %{_libdir}/sympa/bin/* # Locales %dir %{_libdir}/sympa/nls %{_libdir}/sympa/nls/*.cat %{_libdir}/sympa/nls/*.msg # Data %dir %{_datadir}/sympa %{_datadir}/sympa/ca-bundle.crt %{_datadir}/sympa/create_list.conf %dir %{_datadir}/sympa/create_list_templates %{_datadir}/sympa/create_list_templates/* %{_datadir}/sympa/edit_list.conf %{_datadir}/sympa/mhonarc-ressources %dir %{_datadir}/sympa/scenari %{_datadir}/sympa/scenari/* %dir %{_datadir}/sympa/templates %{_datadir}/sympa/templates/* # Examples %dir %{_datadir}/sympa/examples %dir %{_datadir}/sympa/examples/config %{_datadir}/sympa/examples/config/sympa.conf %dir %{_datadir}/sympa/examples/db %{_datadir}/sympa/examples/db/* %dir %{_datadir}/sympa/examples/expl %{_datadir}/sympa/examples/expl/* %dir %{_datadir}/sympa/examples/sample %{_datadir}/sympa/examples/sample/* %dir %{_datadir}/sympa/examples/script %{_datadir}/sympa/examples/script/* # Init scripts %defattr(0755,root,root) %config(noreplace) %{_initrddir}/sympa ## ## WWSympa file list ## # Spools %dir /var/spool/sympa/wwsarchive %dir /var/spool/sympa/wwsbounce # Documentation # Config file, permissions are reset in %post as (0640,sympa,sympa) %config(noreplace) %{conf_s}/wwsympa.conf %dir %{conf_s}/wws_templates # Icons and binaries for Apache %{home_a}/cgi-bin/wwsympa.fcgi %dir %{home_a}/icons/sympa %{home_a}/icons/sympa/*.gif # Templates %dir %{_datadir}/sympa/wws_templates %{_datadir}/sympa/wws_templates/* # Sample files %{_datadir}/sympa/examples/config/wwsympa.conf %clean rm -rf $RPM_BUILD_ROOT %changelog * Thu Aug 15 2002 Pixel <pixel@mandrakesoft.com> 3.2.1-5mdk - rebuild for perl 5.8.0 * Sun Feb 24 2002 Frederic Lepied <flepied@mandrakesoft.com> 3.2.1-4mdk - corrected init script to be grpintify compliant * Mon Nov 26 2001 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.2.1-3mdk - Add apache in group sympa so that wwsympa could work * Sun Sep 16 2001 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.2.1-2mdk - Get rid of /usr/sbin/usermod * Mon Sep 10 2001 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.2.1-1mdk - Rework Patch0 to propagate ICONSDIR and substitute wwsympa.conf - Major cleanups based on guidance from Server team and Debian package: - sympa.conf: move to the dedicated dir /etc/sympa - sympa.conf: set pid file to /var/run/sympa/sympa.pid - wwsympa.conf: move to the dedicated dir /etc/sympa - wwsympa.conf: arc_path is now /var/spool/sympa/wwsarchive - wwsympa.conf: bounce_path is now /var/spool/sympa/wwsbounce - mailing-list descriptions still go to %{_localstatedir}/sympa/expl - Changes from François: - Updated to 3.2.1. - Created Patch1 to use Digest::MD5 instead of MD5 module. * Tue Aug 28 2001 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.0.3-2mdk - Rebuild for correct dependencies * Fri Apr 13 2001 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 3.0.3-1mdk - updated to stable version 3.0.3 - sanitized specfile (s/Copyright/License, server macros, Requires, etc.) - sanitized build process: DESTDIR is set to %{home_s} - added directory in sympa home for pids - added missing variables when generating config files (patch0) - fixed file to chown (wwsympa.conf) in %%post section - fixed syslog variable in /etc/[ww]sympa.conf - removed patch1: log_socket_type=inet, openssl path are set correctly - removed patch2: use_fast_cgi=0, no html archives (mhonarc path unset) * Wed Oct 11 2000 Chmouel Boudjnah <chmouel@mandrakesoft.com> 2.7.3-7mdk - Make something smarter than exit 1 when doing an upgrade and moving the sympa files. * Fri Oct 6 2000 Denis Havlik <denis@mandrakesoft.com> 2.7.3-6mdk - changed home-dir to /var/lib/sympa, fixed config. files - fixed licence (GPL now) * Wed Aug 30 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.7.3-5mdk - requires apache because of wwsympa. - buildrequires apache to fix building for machines without apache (sic). * Fri Aug 18 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.7.3-4mdk - rebuild to enable openssl. - add requires and buildrequires for {openssl,openssl-devel} - copy the wwsympa configuration file on postun if none is present in /etc. * Thu Aug 17 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.7.3-3mdk - rebuild to fix some more annoying bugs. * Mon Aug 14 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.7.3-2mdk - rebuild for sympa disaster * Tue Aug 01 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.7.3-1mdk - big shiny new version and got this ugly fucking piece of shit to package - rebuild for BM * Tue Apr 18 2000 Jerome Dumonteil <jd@mandrakesoft.com> - change group * Fri Mar 31 2000 Jerome Dumonteil <jd@mandrakesoft.com> - change group - modif postun * Wed Dec 29 1999 Jerome Dumonteil <jd@mandrakesoft.com> - version 2.4 * Fri Dec 17 1999 Jerome Dumonteil <jd@mandrakesoft.com> - added link /etc/smrsh/queue - added link for /home/sympa/expl/helpfile * Thu Dec 09 1999 Jerome Dumonteil <jd@mandrakesoft.com> - remove backup files from sources - strip binary * Mon Dec 6 1999 Jerome Dumonteil <jd@mandrakesoft.com> - added prereq info. - little cleanup. * Fri Dec 3 1999 Jerome Dumonteil <jd@mandrakesoft.com> - first version of rpm.