File ssmtp.spec of Package ssmtp

#  
# spec file for package ssmtp  
#  
# sSMTP is licensed under the GNU General Public License (GPL)
#   version 2 or above.
# 
#   Copyright (C) 2004-2008  Anibal Monsalve Salazar <anibal@debian.org>
# 
# This file and all modifications and additions to the pristine  
# package are under the same license as the package itself.  
#  
# Please submit bugfixes or comments via 
#   http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=ssmtp;dist=unstable
#
# Current ssmtp Maintainers:
#   Anibal Monsalve Salazar <anibal@debian.org>
#     http://qa.debian.org/developer.php?login=anibal%40debian.org
#   Santiago Ruano Rincón <santiago@debian.org>
#     http://qa.debian.org/developer.php?login=santiago%40debian.org

#########################################################################################  
# Commom part  
#########################################################################################  
Name:           ssmtp
Version:        2.61
Release:        21.1.%{?dist}
Summary:        Extremely simple MTA to get mail off the system to a Mailhub
Group:          Applications/Internet
License:        GPLv2+
URL:            http://packages.debian.org/stable/mail/ssmtp
Source0:        ftp://ftp.debian.org/debian/pool/main/s/%{name}/%{name}_%{version}.orig.tar.gz
#Patch0		http://ftp.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.61-9.diff.gz
Patch0:         %{name}-%{version}.6.patch
Patch1:         %{name}-2.50.3-maxsysuid.patch
Patch2:         %{name}-defaultvalues.patch
Patch3:         %{name}-ssl.certificate.nomatch.patch
Patch4:         %{name}-password-leak.patch
Patch5:         %{name}-bcc-fix.patch
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340803
# replaces RSA's md5 with a GPL compatible implementation
Patch6:         %{name}-md5auth-non-rsa
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Provides:       %{_sbindir}/sendmail
Requires(post): %{_sbindir}/update-alternatives
Requires(preun):%{_sbindir}/update-alternatives
BuildRequires:  openssl-devel

%description
A secure, effective and simple way of getting mail off a system to your mail
hub. It contains no suid-binaries or other dangerous things - no mail spool
to poke around in, and no daemons running in the background. Mail is simply
forwarded to the configured mailhost. Extremely easy configuration.

WARNING: the above is all it does; it does not receive mail, expand aliases
or manage a queue. That belongs on a mail hub with a system administrator.

Authors:
 David Collier-Brown, davecb@hobbes.ss.org, davecb@sni.ca or dave@lethe.uucp
 Christoph Lameter, clameter@debian.org, clameter@waterf.org, clameter@i-m-f.org
 Hugo Haas, hugo@debian.org, hugo@larve.net, hugo@via.ecp.fr
 Matt Ryan, mryan@debian.org, matt.ryan@banana.org.uk

TLS support from Tobias Rundstrom <tobi@tobi.nu>
IPv6 support from Jun-ya Kato <kato@goto.info.waseda.ac.jp>
MD5 authentication support from TAKIZAWA Takashi <aki@luna.email.ne.jp>

Current Maintainer:
  Anibal Monsalve Salazar <anibal@debian.org>
  Santiago Ruano Rincón <santiago@debian.org>

%prep
%setup  -q
%patch  -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

########################################  
# Fedora, RHEL or CentOS  
########################################  
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
 %define alternatives alternatives
%endif

########################################  
# Mandriva  
########################################  
%if %{defined mandriva_version}
  %define alternatives alternatives
%endif

########################################  
# SuSE, openSUSE  
########################################  
%if %{defined suse_version}
  %define alternatives update-alternatives
%endif
%if 0%{?opensuse_bs}
  # OBS-specific parts here
  #Support: rpmlint-bs  # causes fail with: cannot open Pubkeys index using db3 - No such file or directory (2)
%endif

#########################################################################################  
# Build
#########################################################################################  
%build

#%if 0%{?suse_version} > 930
#%if %{defined fedora_version}
#%if 0%{?fedora_version} < 5
#%if %{defined mandriva_version}
#%if 0%{?mandriva_version} > 2006
#%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}

#%ifarch x86_64

########################################  
# Fedora, RHEL or CentOS  
########################################  

#on RHEL3 krb5 is somewhere else
#test -e /usr/include/krb5.h || CPPFLAGS="-I/usr/kerberos/include"
#CPPFLAGS=$(pkg-config --cflags-only-I openssl)
%if "0%{?dist}" == "0.el3" 
  %define cppflags -I/usr/kerberos/include
%endif
%configure --enable-ssl --enable-md5auth --enable-inet6
%if "0%{?dist}" == "0.el3" 
  make %{?_smp_mflags} CPPFLAGS=%{cppflags}
%else
  make %{?_smp_mflags}
%endif

########################################  
# Mandriva  
########################################  
%if %{defined mandriva_version}
%endif

######################################## 
# SuSE, openSUSE  
########################################  

#########################################################################################
# Install
#########################################################################################
%install 
rm -rf %{buildroot}
install -p -D -m 755 %{name} %{buildroot}%{_sbindir}/%{name}
#install -p -D -m 755 generate_config_alt %{buildroot}%{_bindir}/generate_config_alt
mkdir %{buildroot}%{_bindir}/
install -p -D -m 644 revaliases %{buildroot}%{_sysconfdir}/ssmtp/revaliases
install -p -m 644 ssmtp.conf %{buildroot}%{_sysconfdir}/ssmtp/ssmtp.conf
install -p -D -m 644 ssmtp.8 %{buildroot}%{_mandir}/man8/ssmtp.8
install -p -D -m 644 debian/mailq.8 %{buildroot}%{_mandir}/man1/mailq.ssmtp.1
install -p -m 644 debian/newaliases.8 %{buildroot}%{_mandir}/man1/newaliases.ssmtp.1
install -p -D -m 644 ssmtp.conf.5 %{buildroot}%{_mandir}/man5/ssmtp.conf.5
ln -s %{_sbindir}/%{name} %{buildroot}%{_sbindir}/sendmail.ssmtp
ln -s %{_sbindir}/%{name} %{buildroot}%{_bindir}/newaliases.ssmtp
ln -s %{_sbindir}/%{name} %{buildroot}%{_bindir}/mailq.ssmtp

#########################################################################################  
# Clean
#########################################################################################  
%clean
rm -rf %{buildroot}

#########################################################################################
# Post
#########################################################################################
%post
%{_sbindir}/%{alternatives}  --install %{_sbindir}/sendmail mta %{_sbindir}/sendmail.ssmtp 30 \
  --slave %{_bindir}/mailq mta-mailq %{_bindir}/mailq.ssmtp \
  --slave %{_bindir}/newaliases mta-newaliases %{_bindir}/newaliases.ssmtp \
  --slave %{_mandir}/man1/mailq.1.gz mta-mailqman %{_mandir}/man1/mailq.ssmtp.1.gz \
  --slave %{_mandir}/man1/newaliases.1.gz mta-newaliasesman %{_mandir}/man1/newaliases.ssmtp.1.gz \
  --slave %{_mandir}/man8/sendmail.8.gz mta-sendmailman %{_mandir}/man8/ssmtp.8.gz 

#########################################################################################
# Prerun
#########################################################################################
%preun
#only remove in case of erase (but not at upgrade)
if [ $1 -eq 0 ] ; then
  %{_sbindir}/%{alternatives} --remove mta %{_sbindir}/sendmail.ssmtp
fi
exit 0

#%postun
#if [ $1 -eq 0 ] ; then
#  %{_sbindir}/%{alternatives} --auto mta
#fi
#exit 0

#########################################################################################
# Files
#########################################################################################
%files
%defattr(-,root,root,-)
%doc COPYING INSTALL README TLS CHANGELOG_OLD debian/changelog
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_mandir}/man1/*
%{_sbindir}/%{name}
#%{_bindir}/generate_config_alt
%{_sbindir}/sendmail.ssmtp
%{_bindir}/newaliases.ssmtp
%{_bindir}/mailq.ssmtp
%dir %{_sysconfdir}/ssmtp/
%config(noreplace) %{_sysconfdir}/ssmtp/revaliases
%config(noreplace) %{_sysconfdir}/ssmtp/ssmtp.conf

#########################################################################################
# Changelog
#########################################################################################
%changelog
* Fri Jul 11 2008 Mark Van De Vyver <mvyver@gmail.com> 2.61-21.1
- Added to openSUSE Build Service, builds for: openSUSE 11.0

* Tue Feb 12 2008 Manuel "lonely wolf" Wolfshant <wolfy@nobugconsulting.ro> 2.61-11.5.3
- rebuilt for gcc 4.3.0

* Wed Dec 5 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.5.2
- rebuilt for newer openssl
- fix usage of disttag for compatibility with mock + el3

* Wed Oct 24 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.5.1
- adds back /usr/sbin/sendmail provides, rpmbuild by default does not add it

* Wed Oct 24 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.5
- fixes https://bugzilla.redhat.com/show_bug.cgi?id=235594 by removing MTA
  and smtpdaemon provides, as the packages which required those were fixed

* Tue Oct 16 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.4
- includes patch from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340803
  replacing md5 from RSA with a version released under GPLv2+
- fix URL for upstream

* Fri Aug 22 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.3.1
- rebuilt

* Fri Aug 10 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.3
- fix release tag, previous one did not match the changelog

* Fri Aug 3 2007 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.2
- license clarification

* Sun Dec 10 2006 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11.1
- fix double %%changelog entry

* Fri Dec 08 2006 lonely wolf <wolfy@nobugconsulting.ro> 2.61-11
- fix security leak (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=369542 )
- include more patches from debian (report an error in treating Bcc: addresses and if the SSL certificate does not match )

* Tue Nov 28 2006 lonely wolf <wolfy@nobugconsulting.ro> 2.61-10
- fix silly typo in changelog

* Tue Nov 28 2006 lonely wolf <wolfy@nobugconsulting.ro> 2.61-9
- included Ville Skyttä's patch for saner default values in ssmtp.conf (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=217270)

* Mon Oct 10 2006 lonely wolf <wolfy@pcnet.ro> 2.61-8
- enabled IPv6 (just added this option to %%configure, the capability was already there)
- removed yet another man page from %%Provides
- cosmetic fixes - consistent use of macros
- added a missing Require
- I have also included a [commented] URL to the current patch (v9) provided by Debian. Because starting with version 8 the patch modifies the SSL libraries used. I will include this modification once I can perform more tests. 

* Mon Oct 10 2006 lonely wolf <wolfy@pcnet.ro> 2.61-7
- removed man pages and stubs from %%Provides

* Fri Sep 22 2006 lonely wolf <wolfy@pcnet.ro> 2.61-6
- cosmetic fixes

* Tue Apr 11 2006 lonely wolf <wolfy@pcnet.ro> 2.61-5
- cleaner hack for RHEL 3
- added back Provides: smtpdaemon
- correct typo in Provides
 
* Tue Apr 11 2006 lonely wolf <wolfy@pcnet.ro> 2.61-4
- hack for RHEL 3 which has krb5.h in a different place
 
* Mon Apr 10 2006 lonely wolf <wolfy@pcnet.ro> 2.61-3
- removed Requires: openssl
- removed Provides: smtpdaemon
- cleaning of %%files
- correct typos in version numbers in changelog
- disabled "alternatives --auto mta" in postrun macro, pending more tests

* Sat Apr 8 2006 lonely wolf <wolfy@pcnet.ro> 2.61-2
- fix spec file: consistent use of buildroot macro, no double "ssmtp" in files' name, switch back the name of the main patch to the one used by Debian
- removed the generate_config_alt script; it is ugly, buggy and completely replaces the default provided configuration file, including the comments (which are useful)
- add openssl to requires and openssl-devel to buildrequires
- fix pre/post install scriptlets (upgrade would have removed the files from the alternatives system)
- remove two unneeded files from the alternatives call; man sendmail will default to the page provided by ssmtp

* Thu Apr 6 2006 lonely wolf <wolfy@pcnet.ro> 2.61-1
- Initial rpm version, based on Debian sources & patch
- Includes patch from Mandrake to lower the default system UIDs from 1000 to 500
- Includes generate_config_alt, a small script to generate a customized ssmtp.conf (thus overriding the default one); beware that this script will completely replace the default ssmtp.conf.
- Customized to play nice in the alternatives environment
openSUSE Build Service is sponsored by