lkundrak / rpms / sendmail

Forked from rpms/sendmail 4 years ago
Clone
Blob Blame History Raw
%define initdir /etc/rc.d/init.d

Summary: A widely used Mail Transport Agent (MTA).
Name: sendmail
Version: 8.11.0
Release: 8
Copyright: BSD
Group: System Environment/Daemons
Provides: smtpdaemon
Source0: ftp://ftp.cs.berkeley.edu/ucb/sendmail/sendmail.%{version}.tar.gz
Source1: sendmail.init
Source2: http://www.informatik.uni-kiel.de/%7Eca/email/rules/check.tar
Source3: aliases
Source4: sendmail.sysconfig
Source5: sendmail-8.9.3-etc-mail-Makefile
Source6: sendmail-redhat.mc
Source7: Sendmail.conf
Patch0: sendmail-8.11.0-redhat.patch
Patch1: sendmail-8.10.0-makemapman.patch
Patch2: sendmail-8.10.0-smrsh-paths.patch
Patch3: sendmail-8.8.7-rmail.patch
Patch4: sendmail-8.10.0-aliasesDoS.patch
Patch5: sendmail-8.10.1-movefiles.patch
Patch6: sendmail-8.10.1-manpath.patch
Patch7: sendmail-8.11.0-m4path.patch
Patch8: ldapfix.patch
Buildroot: %{_tmppath}/%{name}-root
Prereq: /sbin/chkconfig /usr/sbin/useradd /etc/init.d
Requires: procmail

%description
The Sendmail program is a very widely used Mail Transport Agent (MTA).
MTAs send mail from one machine to another. Sendmail is not a client
program, which you use to read your e-mail. Sendmail is a
behind-the-scenes program which actually moves your e-mail over
networks or the Internet to where you want it to go.

If you ever need to reconfigure Sendmail, you'll also need to have the
sendmail.cf package installed.  If you need documentation on Sendmail,
you can install the sendmail-doc package.

%package doc
Summary: Documentation about the Sendmail Mail Transport Agent program.
Group: Documentation

%description doc
The sendmail-doc package contains documentation about the Sendmail
Mail Transport Agent (MTA) program, including release notes, the
Sendmail FAQ and a few papers written about Sendmail.  The papers are
provided in PostScript(TM) and troff formats.

Install the sendmail-doc package if you need documentation about
Sendmail.

%package cf
Summary: The files needed to reconfigure Sendmail.
Group: System Environment/Daemons

%description cf
This package includes the configuration files which you'd need to
generate the sendmail.cf file distributed with the sendmail package.
You'll need the sendmail-cf package if you ever need to reconfigure
and rebuild your sendmail.cf file.  For example, the default
sendmail.cf file is not configured for UUCP.  If someday you needed to
send and receive mail over UUCP, you'd need to install the sendmail-cf
package to help you reconfigure Sendmail.

Install the sendmail-cf package if you need to reconfigure your
sendmail.cf file.

%prep
%setup -q
%patch0 -p1 -b .redhat
%patch1 -p1 -b .makemapman
%patch2 -p1 -b .smrsh
%patch3 -p1 -b .rmail
%patch4 -p1 -b .aliases
%patch5 -p1 -b .movestuff
%patch6 -p0
%patch7 -p1 -b .m4path
pushd sendmail
patch -s -p1 -b -z .shapiro -l < %{PATCH8}
popd

sed -e 's|@@PATH@@|\.\.|' < %{SOURCE6} > cf/cf/redhat.mc

%build
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -DUSE_VENDOR_CF_PATH=1"

cd sendmail
sh Build -f ../redhat.config.m4
cd ..

cd mailstats
sh Build -f ../redhat.config.m4
cd ..

cd rmail
sh Build -f ../redhat.config.m4
cd ..

cd makemap
sh Build -f ../redhat.config.m4
cd ..

cd praliases
sh Build -f ../redhat.config.m4
cd ..

cd smrsh
sh Build -f ../redhat.config.m4
cd ..

cd cf/cf
m4 redhat.mc > redhat.cf

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT

cd $RPM_BUILD_ROOT
mkdir -p etc/sysconfig $RPM_BUILD_ROOT%{initdir}
mkdir -p usr/bin usr/lib .%{_mandir}/man{1,5,8} usr/sbin var/log var/spool usr/lib/sendmail-cf
cd -

OBJDIR=obj.$(uname -s).$(uname -r).$(arch)

make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 install -C $OBJDIR/sendmail
make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 install -C $OBJDIR/mailstats
make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 install -C $OBJDIR/praliases
make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 force-install -C $OBJDIR/rmail
make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 install -C $OBJDIR/makemap
ln -sf ../sbin/makemap $RPM_BUILD_ROOT/usr/bin/makemap
make DESTDIR=$RPM_BUILD_ROOT SBINOWN=`id -nu` UBINOWN=`id -nu` SBINGRP=`id -ng` UBINGRP=`id -ng` MANOWN=`id -nu` MANGRP=`id -ng` \
 install -C $OBJDIR/smrsh

# install docs by hand
mkdir -p $RPM_BUILD_ROOT%{_docdir}/sendmail
cp -ar FAQ LICENSE KNOWNBUGS README RELEASE_NOTES doc $RPM_BUILD_ROOT%{_docdir}/sendmail
cp smrsh/README $RPM_BUILD_ROOT%{_docdir}/sendmail/README.smrsh
cp cf/README $RPM_BUILD_ROOT%{_docdir}/sendmail/README.cf

# install the cf files
pushd cf
cp -ar * $RPM_BUILD_ROOT/usr/lib/sendmail-cf
rm -f $RPM_BUILD_ROOT/usr/lib/sendmail-cf/*/*.m4path
popd

mkdir -p $RPM_BUILD_ROOT/etc/mail


install -m 644 cf/cf/redhat.cf $RPM_BUILD_ROOT/etc/sendmail.cf
sed -e 's|@@PATH@@|/usr/lib/sendmail-cf|' < %{SOURCE6} > $RPM_BUILD_ROOT/etc/mail/sendmail.mc
echo "# local-host-names - include all aliases for your machine here." > $RPM_BUILD_ROOT/etc/mail/local-host-names

ln -sf ../sbin/sendmail $RPM_BUILD_ROOT/usr/lib/sendmail
install -d -m755 $RPM_BUILD_ROOT/var/spool/mqueue

# dangling symlinks
for f in hoststat mailq newaliases purgestat
  do
    ln -sf ../sbin/sendmail $RPM_BUILD_ROOT/usr/bin/${f}
  done
mkdir -p $RPM_BUILD_ROOT/etc/smrsh

cat <<EOF > $RPM_BUILD_ROOT/etc/mail/access
# Check the /usr/doc/sendmail-%{version}/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/doc/sendmail-%{version}/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain		RELAY
localhost			RELAY
127.0.0.1			RELAY

EOF
for map in virtusertable access domaintable mailertable
  do
    touch $RPM_BUILD_ROOT/etc/mail/${map}
    chmod 0644 $RPM_BUILD_ROOT/etc/mail/${map}
    $RPM_BUILD_ROOT/usr/bin/makemap -C $RPM_BUILD_ROOT/etc/sendmail.cf hash $RPM_BUILD_ROOT/etc/mail/${map}.db < $RPM_BUILD_ROOT/etc/mail/${map}
    chmod 0644 $RPM_BUILD_ROOT/etc/mail/${map}.db
  done
install -m644 %{SOURCE3} $RPM_BUILD_ROOT/etc/aliases
$RPM_BUILD_ROOT/usr/bin/makemap -C $RPM_BUILD_ROOT/etc/sendmail.cf hash $RPM_BUILD_ROOT/etc/aliases.db < %{SOURCE3}

install -m644 %SOURCE4 $RPM_BUILD_ROOT/etc/sysconfig/sendmail
install -m755 %SOURCE1 $RPM_BUILD_ROOT%{initdir}/sendmail

install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/etc/mail/Makefile

chmod u+w $RPM_BUILD_ROOT/usr/sbin/{mailstats,praliases}
chmod u+w $RPM_BUILD_ROOT/usr/bin/rmail

strip $RPM_BUILD_ROOT/usr/sbin/{mailstats,praliases,sendmail}
strip $RPM_BUILD_ROOT/usr/bin/rmail

install -m755 -d $RPM_BUILD_ROOT%{_libdir}/sasl
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_libdir}/sasl/Sendmail.conf

%clean
rm -rf $RPM_BUILD_ROOT

%pre
/usr/sbin/useradd -u 47 -d /var/spool/mqueue -r -s /dev/null mailnull >/dev/null 2>&1 || :

%postun
if [ "$1" -ge "1" ]; then
    %{initdir}/sendmail condrestart >/dev/null 2>&1
fi
if [ $1 = 0 ]; then
	/usr/sbin/userdel mailnull > /dev/null 2>&1 || :
fi

%post
#
# Convert old format to new
#
if [ -f /etc/mail/deny ] ; then
    cat /etc/mail/deny | \
	awk 'BEGIN{ print "# Entries from obsoleted /etc/mail/deny"} \
		  {print $1" REJECT"}' >> /etc/mail/access
    cp /etc/mail/deny /etc/mail/deny.rpmorig
fi
for oldfile in relay_allow ip_allow name_allow ; do
    if [ -f /etc/mail/$oldfile ] ; then
	cat /etc/mail/$oldfile | \
		awk "BEGIN { print \"# Entries from obsoleted /etc/mail/$oldfile\" ;} \
	     { print $1\" RELAY\" }" >> /etc/mail/access
	cp /etc/mail/$oldfile /etc/mail/$oldfile.rpmorig
     fi
done

#
# Oops, these files moved
#
if [ -f /etc/sendmail.cw ] ; then
    cat /etc/sendmail.cw  | \
      awk 'BEGIN { print "# Entries from obsoleted /etc/sendmail.cw" ;} \
           { print $1 }' >> /etc/mail/local-host-names
    cp /etc/sendmail.cw /etc/sendmail.cw.rpmorig
fi
#
# Rebuild maps (next reboot will rebuild also)
#
{ /usr/bin/newaliases
  for map in virtusertable access domaintable mailertable
  do
    if [ -f /etc/mail/${map} ] ; then
      /usr/bin/makemap hash /etc/mail/${map} < /etc/mail/${map}
      sleep 1
    fi
  done
} > /dev/null 2>&1

/sbin/chkconfig --add sendmail

%preun
if [ $1 = 0 ]; then
   %{initdir}/sendmail stop >/dev/null 2>&1
   /sbin/chkconfig --del sendmail
fi

%triggerpostun -- sendmail < 8.10.0
/sbin/chkconfig --add sendmail

%files
%defattr(-,root,root)
/usr/sbin/mailstats
/usr/sbin/praliases
/usr/bin/hoststat
/usr/bin/purgestat
/usr/bin/rmail
/usr/bin/makemap
/usr/sbin/makemap
/usr/sbin/sendmail
/usr/bin/newaliases
/usr/bin/mailq
/usr/sbin/smrsh
/usr/lib/sendmail

%{_mandir}/man8/rmail.8*
%{_mandir}/man8/praliases.8*
%{_mandir}/man8/mailstats.8*
%{_mandir}/man8/makemap.8*
%{_mandir}/man8/sendmail.8*
%{_mandir}/man5/aliases.5*
%{_mandir}/man1/newaliases.1*
%{_mandir}/man1/mailq.1*

/var/log/statistics
# XXX can't do noreplace here or new sendmail will not deliver.
%config				/etc/sendmail.cf
%attr(0644,root,root) %config	/etc/mail/sendmail.mc
%config(noreplace)		/etc/mail/local-host-names
%config(noreplace)		/etc/aliases
%attr(0644,root,mail) %ghost	/etc/aliases.db
%attr(0755,root,mail) %dir	/var/spool/mqueue
%dir /etc/smrsh
%dir /etc/mail

%config /etc/mail/Makefile
%attr(0644,root,root) %ghost			/etc/mail/virtusertable.db
%attr(0644,root,root) %config(noreplace)	/etc/mail/virtusertable

%attr(0644,root,root) %ghost			/etc/mail/access.db
%attr(0644,root,root) %config(noreplace)	/etc/mail/access

%attr(0644,root,root) %ghost			/etc/mail/domaintable.db
%attr(0644,root,root) %config(noreplace)	/etc/mail/domaintable

%attr(0644,root,root) %ghost			/etc/mail/mailertable.db
%attr(0644,root,root) %config(noreplace)	/etc/mail/mailertable

%attr(0644,root,root) %config(noreplace)	/etc/mail/helpfile

%config /etc/sysconfig/sendmail

%config %{initdir}/sendmail

%config %{_libdir}/sasl/Sendmail.conf

%files cf
%defattr(-,root,root)
/usr/lib/sendmail-cf

%files doc
%defattr(-,root,root)
%{_docdir}/sendmail

%changelog
* Tue Aug 22 2000 Nalin Dahyabhai <nalin@redhat.com>
- apply fixes for LDAP maps being closed too soon

* Mon Aug 14 2000 Nalin Dahyabhai <nalin@redhat.com>
- provide /usr/lib/sasl/Sendmail.conf so that people know we can use it (#16064)

* Mon Aug  7 2000 Florian La Roche <Florian.LaRoche@redhat.de>
- enable listening on the smtp port again

* Fri Aug  4 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix "missing find_m4.sh" problem by defining M4=/usr/bin/m4 (#14767)

* Mon Jul 31 2000 Nalin Dahyabhai <nalin@redhat.com>
- okay, enable LDAP support again
- enable SMTP auth support via Cyrus SASL

* Tue Jul 25 2000 Nalin Dahyabhai <nalin@redhat.com>
- disable the LDAP support until we can remove the sendmail->OpenLDAP->perl dep
- fix prereq

* Tue Jul 25 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- update to sendmail 8.11.0
- add LDAP support

* Thu Jul 20 2000 Bill Nottingham <notting@redhat.com>
- move initscript back

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sun Jul  9 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- require procmail
- add further aliases

* Sat Jul  8 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- prereq init.d
- fix typo

* Tue Jul  4 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- ignore error from useradd

* Fri Jun 30 2000 Than Ngo <than@redhat.de>
- FHS fixes
- /etc/rc.d/init.d -> /etc/init.d
- fix initscript

* Fri Jun 23 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- change to /usr/share/man

* Wed Jun 21 2000 Preston Brown <pbrown@redhat.com>
- turn off daemon behaviour by default

* Mon Jun 18 2000 Bill Nottingham <notting@redhat.com>
- rebuild, fix dependencies

* Sat Jun 10 2000 Bill Nottingham <notting@redhat.com>
- prereq /usr/sbin/useradd

* Fri May 19 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- enable MAP_REGEX
- enable tcp_wrapper support

* Thu May 18 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- fix etc/mail/aliases -> /etc/aliases in sendmail-redhat.mc

* Wed May  3 2000 Bill Nottingham <notting@redhat.com>
- update to 8.10.1
- fix build without sendmail installed
- add 'mailnull' user

* Wed Mar 15 2000 Bill Nottingham <notting@redhat.com>
- update to 8.10.0
- remove compatiblity chkconfig links
- add a mailnull user for sendmail to use

* Thu Feb 17 2000 Cristian Gafton <gafton@redhat.com>
- break the hard link for makemap and create it as a symlnk (#8223)

* Thu Feb 17 2000 Bernhard Rosenkränzer <bero@redhat.com>
- Fix location of mailertable (Bug #6035)

* Sat Feb  5 2000 Bill Nottingham <notting@redhat.com>
- fixes for non-root builds (#8178)

* Wed Feb  2 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- change perms on /etc/sysconfig/sendmail from 0755 to 0644
- allow compressed man-pages

* Thu Dec 02 1999 Cristian Gafton <gafton@redhat.com>
- add patch to prevent the DoS when rebuilding aliases

* Wed Sep  1 1999 Jeff Johnson <jbj@redhat.com>
- install man pages, not groff output (#3746).
- use dnl not '#' in m4 comment (#3749).
- add FEATURE(mailtertable) to the config -- example file needs this (#4649).
- use db2 not db1.

* Tue Aug 31 1999 Jeff Johnson <jbj@redhat.com>
- add 127.0.0.1 to /etc/mail/access to avoid IDENT: relay problem (#3178).

* Tue Aug 31 1999 Bill Nottingham <notting@redhat.com>
- chkconfig --del in preun, not postun (#3982)

* Mon Aug 16 1999 Bill Nottingham <notting@redhat.com>
- initscript munging

* Fri Jul 02 1999 Cristian Gafton <gafton@redhat.com>
- fixed typo bug in comment in the default .mc file (#2812)

* Mon Apr 19 1999 Cristian Gafton <gafton@redhat.com>
- fox the awk scripts in the postinstall
- enable FEATURE(accept_unresolvable_domains) by default to make laptop
  users happy.

* Sun Apr 18 1999 Cristian Gafton <gafton@redhat.com>
- make the redhat.mc be a separate source files. Sanitize patches that used
  to touch it.
- install redhat.mc as /etc/sendmail.mc so that people can easily modify
  their sendmail.cf configurations.

* Mon Apr 05 1999 Cristian Gafton <gafton@redhat.com>
- fixed virtusertable patch
- make smrsh look into /etc/smrsh

* Mon Mar 29 1999 Jeff Johnson <jbj@redhat.com>
- remove noreplace attr from sednmail.cf.

* Thu Mar 25 1999 Cristian Gafton <gafton@redhat.com>
- provide a more sane /etc/mail/access default config file
- use makemap to initializa the empty databases, not touch
- added a small, but helpful /etc/mail/Makefile

* Mon Mar 22 1999 Jeff Johnson <jbj@redhat.com>
- correxct dangling symlinks.
- check for map file existence in %post.

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 3)

* Fri Mar 19 1999 Jeff Johnson <jbj@redhat.com>
- improved 8.9.3 config from Mike McHenry <mmchen@minn.net>

* Tue Mar 16 1999 Cristian Gafton <gafton@redhat.com>
- version 8.9.3

* Tue Dec 29 1998 Cristian Gafton <gafton@redhat.com>
- build for 6.0
- use the libdb1 stuff correctly

* Mon Sep 21 1998 Michael K. Johnson <johnsonm@redhat.com>
- Allow empty QUEUE in /etc/sysconfig/sendmail for those who
  want to run sendmail in daemon mode without processing the
  queue regularly.

* Thu Sep 17 1998 Michael K. Johnson <johnsonm@redhat.com>
- /etc/sysconfig/sendmail

* Fri Aug 28 1998 Jeff Johnson <jbj@redhat.com>
- recompile statically linked binary for 5.2/sparc

* Tue May 05 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Sat May 02 1998 Cristian Gafton <gafton@redhat.com>
- enhanced initscripts

* Fri May 01 1998 Cristian Gafton <gafton@redhat.com>
- added a rmail patch

* Wed Oct 29 1997 Donnie Barnes <djb@redhat.com>
- argh!  Fixed some of the db1 handling that had to be added for glibc 2.1

* Fri Oct 24 1997 Donnie Barnes <djb@redhat.com>
- added support for db1 on SPARC

* Thu Oct 16 1997 Donnie Barnes <djb@redhat.com>
- added chkconfig support
- various spec file cleanups
- changed group to Networking/Daemons (from Daemons).  Sure, it runs on
  non networked systems, but who really *needs* it then?

* Wed Oct 08 1997 Donnie Barnes <djb@redhat.com>
- made /etc/mail/deny.db a ghost
- removed preun that used to remove deny.db (ghost handles that now)
- NOTE: upgrading from the sendmail packages in 4.8, 4.8.1, and possibly
  4.9 (all Red Hat betas between 4.2 and 5.0) could cause problems.  You
  may need to do a makemap in /etc/mail and a newaliases after upgrading
  from those packages.  Upgrading from 4.2 or prior should be fine.

* Mon Oct 06 1997 Erik Troan <ewt@redhat.com>
- made aliases.db a ghost

* Tue Sep 23 1997 Donnie Barnes <djb@redhat.com>
- fixed preuninstall script to handle aliases.db on upgrades properly

* Mon Sep 15 1997 Donnie Barnes <djb@redhat.com>
- fixed post-install output and changed /var/spool/mqueue to 755

* Thu Sep 11 1997 Donnie Barnes <djb@redhat.com>
- fixed /usr/lib/sendmail-cf paths

* Tue Sep 09 1997 Donnie Barnes <djb@redhat.com>
- updated to 8.8.7
- added some spam filtration
- combined some makefile patches
- added BuildRoot support

* Wed Sep 03 1997 Erik Troan <ewt@redhat.com>
- marked initscript symlinks as missingok
- run newalises after creating /var/spool/mqueue

* Thu Jun 12 1997 Erik Troan <ewt@redhat.com>
- built against glibc, udated release to -6 (skipped -5!)

* Tue Apr 01 1997 Erik Troan <ewt@redhat.com>
- Added -nsl on the Alpha (for glibc to provide NIS functions).

* Mon Mar 03 1997 Erik Troan <ewt@redhat.com>
- Added nis support.