File sendmail.spec of Package uucp

#
# spec file for package sendmail (Version 8.14.4)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           sendmail
BuildRequires:  db-devel mailx openldap2-devel procmail tcpd-devel vacation
Url:            http://www.sendmail.org/
%define         SUBDIRS libsmutil libsmdb sendmail mail.local mailstats makemap praliases rmail smrsh libmilter libsm editmap
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Productivity/Networking/Email/Servers
PreReq:         %fillup_prereq %insserv_prereq
PreReq:         /bin/mv /bin/rm /bin/sed
PreReq:         sysvinit(network) sysvinit(syslog)
Provides:       sendcf smailcfg smtp_daemon sendmail-tls
Requires:       filesystem procmail netcfg m4 /bin/fuser
Conflicts:      smail postfix postfix-tls
Obsoletes:      sendmail-tls
AutoReqProv:    on
Version:        8.14.4
Release:        59
Summary:        BSD Sendmail
Source0:        ftp://ftp.sendmail.org/pub/sendmail/sendmail-%{version}.tar.bz2
Source1:        FAQ.sendmail-8.14.bz2
Source2:        sendmail-rpmlintrc
Patch0:         sendmail-%{version}.dif
Patch1:         sendmail-8.13.5-select.dif
Patch2:         sendmail-8.14.3-largeDNS.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%global         _sysconfdir	%{_sysconfdir}
%global         _mailcnfdir	%{_sysconfdir}/mail
%global         _localstatedir  %{_localstatedir}

%description
The "Unix System Administration Handbook" calls sendmail "The most
complex and complete mail delivery system in common use..." .

Ready-made configuration files are included for systems connected by
TCP/IP (with or without a name server) and for systems using UUCP.

'procmail' is used as a local mail agent.

"sendmail" is a trademark of Sendmail, Inc.



Authors:
--------
    Eric Allman <sendmail@sendmail.ORG>

%package -n sendmail-devel
Summary:        BSD Sendmail Development Kit
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Development/Libraries/Other
AutoReqProv:    on

%description -n sendmail-devel
This package includes libraries and header files for building tools to
access sendmail features.

"sendmail" is a trademark of Sendmail, Inc.



Authors:
--------
    Eric Allman <sendmail@sendmail.ORG>

%package -n rmail
Version:        8.14.3
Release:        59
Summary:        Rmail of the BSD Sendmail
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Productivity/Networking/Email/Servers
AutoReqProv:    on

%description -n rmail
Rmail interprets incoming mail received via uucp and passing the
processed mail on to the MTA (e.g. sendmail).



Authors:
--------
    Eric Allman <sendmail@sendmail.ORG>

%prep
%setup
%patch -P 1 -p 0 -b .select
%patch -P 2 -p 0 -b .xxldns
%patch -P 0 -p 0
    set -f
    cat <<-EOF > file-list
	%%defattr(-,root,root)
	%%dir    %%attr(1750,root,root)   %{_localstatedir}/run/sendmail
	%%dir    %%attr(0750,root,root)   %{_localstatedir}/lib/sendmail
	%%attr(0600,root,root)            %{_localstatedir}/lib/sendmail/statistics
	%%attr(0600,root,root)            %{_mailcnfdir}/statistics
	%%dir    %%attr(0700,root,root)   %{_localstatedir}/spool/mqueue
	%%dir    %%attr(0700,root,root)   %{_localstatedir}/spool/mqueue/.hoststat
	# Part of filesystem RPM
	# %%dir    %%attr(0770,root,mail) %{_localstatedir}/spool/clientmqueue
	%%attr(0660,root,mail)            %{_localstatedir}/spool/clientmqueue/sm-client.st
	%%config %%attr(0644,root,root)   %{_sysconfdir}/permissions.d/sendmail
	%%config %%attr(0644,root,root)   %{_sysconfdir}/permissions.d/sendmail.paranoid
	EOF
    set +f

%build
    #
    ID=$(id -u)
    RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing"
    ARCH_LIB=%{_lib}
    export ARCH_LIB
    make clean
    # ingnore vacation (we have our own)
    make %{?jobs:-j%jobs} SUBDIRS="%{SUBDIRS}"

%install
    ID=$(id -u)
    ARCH_LIB=%{_lib}
    export ARCH_LIB
    doc=%{buildroot}%{_defaultdocdir}/sendmail
    if test "$ID" -ne 0 ; then
	mkdir bin
	PATH=${PWD}/bin:$PATH
	(cat > bin/install)<<-EOF
	#!/bin/bash
	argv=""
	while test \$# -gt 0; do
	    case "\$1" in
	    -o) shift 2;;
	    -g) shift 2;;
	    *)  argv="\${argv:+"\$argv "}\$1"
		shift
	    esac
	done
	set -- \$(echo \${argv})
	exec -a install %{_bindir}/install \${1+"\$@"}
	EOF
	chmod 755 bin/install
	type -p install
    fi
    mkdir -p ${doc}
    mkdir -p %{buildroot}/sbin/conf.d
    mkdir -p %{buildroot}%{_bindir}
    mkdir -p %{buildroot}%{_sbindir}
    mkdir -p %{buildroot}%{_mailcnfdir}/certs
    mkdir -p %{buildroot}%{_mailcnfdir}/auth
    mkdir -p %{buildroot}%{_sysconfdir}/init.d
    mkdir -p %{buildroot}%{_sysconfdir}/pam.d
    mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
    mkdir -p %{buildroot}%{_libdir}
    mkdir -p %{buildroot}%{_prefix}/lib/sendmail.d/bin
    mkdir -p %{buildroot}%{_datadir}/sendmail
    mkdir -p %{buildroot}%{_includedir}/sm
    mkdir -p %{buildroot}%{_includedir}/sm/os
    chmod 0750 %{buildroot}%{_mailcnfdir}/certs
    chmod 0750 %{buildroot}%{_mailcnfdir}/auth
    mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
    mkdir -p %{buildroot}%{_mandir}/man1
    mkdir -p %{buildroot}%{_mandir}/man5
    mkdir -p %{buildroot}%{_mandir}/man8
    mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
    make \
	DESTDIR=%{buildroot} \
	SUBDIRS="%{SUBDIRS}" \
	MANROOTMAN=%{_mandir}/man \
	MANROOT=%{_mandir}/cat \
	install
    # needed to be able to comple a milter which uses libsm, i.e. amavis-milter
    cd include/sm
    ln -s os/sm_os_linux.h sm_os.h
    cd ../../
    cd include/sm/os
    ln -s sm_os_linux.h sm_os.h
    cd ../../../
    cp -pr include/sm  %{buildroot}%{_includedir}/
    test "$ID" -ne 0 || \
    chown root:root    %{buildroot}%{_mailcnfdir}/submit.cf
    chmod 0644	       %{buildroot}%{_mailcnfdir}/submit.cf
    test "$ID" -ne 0 || \
    chown root:mail    %{buildroot}%{_sbindir}/sendmail
    ln -sf %{_sbindir}/sendmail %{buildroot}%{_prefix}/lib/sendmail
    mv %{buildroot}%{_sbindir}/praliases \
			      %{buildroot}%{_bindir}/praliases
    mkdir -p           %{buildroot}%{_localstatedir}/spool/mqueue/.hoststat
    test "$ID" -ne 0 || \
    chown -R root:root %{buildroot}%{_localstatedir}/spool/mqueue
    chmod 0700         %{buildroot}%{_localstatedir}/spool/mqueue
    chmod 0700         %{buildroot}%{_localstatedir}/spool/mqueue/.hoststat
    mkdir -p           %{buildroot}%{_localstatedir}/run/sendmail
    chmod 1750         %{buildroot}%{_localstatedir}/run/sendmail
    mkdir -p           %{buildroot}%{_localstatedir}/lib/sendmail
    chmod 0750         %{buildroot}%{_localstatedir}/lib/sendmail
    touch              %{buildroot}%{_localstatedir}/lib/sendmail/statistics
    test "$ID" -ne 0 || \
    chown -R root:root %{buildroot}%{_localstatedir}/lib/sendmail/statistics
    chmod 0600	       %{buildroot}%{_localstatedir}/lib/sendmail/statistics
    ln -sf %{_localstatedir}/lib/sendmail/statistics %{buildroot}%{_mailcnfdir}/statistics
    mkdir -p	       %{buildroot}%{_localstatedir}/spool/clientmqueue
    test "$ID" -ne 0 || \
    chown -R root:mail %{buildroot}%{_localstatedir}/spool/clientmqueue
    chmod 0770         %{buildroot}%{_localstatedir}/spool/clientmqueue
    touch              %{buildroot}%{_localstatedir}/spool/clientmqueue/sm-client.st
    test "$ID" -ne 0 || \
    chown -R root:mail %{buildroot}%{_localstatedir}/spool/clientmqueue/sm-client.st
    chmod 0660         %{buildroot}%{_localstatedir}/spool/clientmqueue/sm-client.st
    chmod 0755         %{buildroot}%{_prefix}/lib/sendmail.d
    chmod 0755         %{buildroot}%{_prefix}/lib/sendmail.d/bin
    chmod 0644         %{buildroot}%{_libdir}/*.a
    ln -sf %{_bindir}/vacation %{buildroot}%{_prefix}/lib/sendmail.d/bin/
    ln -sf %{_bindir}/mail     %{buildroot}%{_prefix}/lib/sendmail.d/bin/
    ln -sf %{_bindir}/procmail %{buildroot}%{_prefix}/lib/sendmail.d/bin/
    install -m 0644 K* README RELE* doc/op/op.ps sendmail/SECURITY \
                       sendmail/TRACEFLAGS suse/README.SuSE \
                       contrib/{e*,re-*,sm*,passwd*}.pl \
		       contrib/etrn.0 ${doc}
    install -m 0644 %{SOURCE1} ${doc}/FAQ.sendmail.bz2
    GROFF_NO_SGR=1 groff -pe -me -mtty-char -Tlatin1 doc/op/op.me > ${doc}/op.txt
    install -m 0644 smrsh/README ${doc}/README.smrsh
    install -m 0644 libmilter/README ${doc}/README.libmilter
    bzip2 -9f ${doc}/*.ps
    bzip2 -9f ${doc}/*.txt
    bzip2 -9f ${doc}/RELEASE_NOTES
    tar cfC - cf . | tar xfC - %{buildroot}%{_datadir}/sendmail/
    test "$ID" -ne 0 || \
    chown root:root -R	%{buildroot}%{_datadir}/sendmail/
    chmod 0755		%{buildroot}%{_datadir}/sendmail/sh/makeinfo.sh
    rm -f  %{buildroot}%{_datadir}/sendmail/cf/Build
    rm -f  %{buildroot}%{_datadir}/sendmail/cf/README
    rm -f  %{buildroot}%{_datadir}/sendmail/cf/Makefile
    rm -f  %{buildroot}%{_datadir}/sendmail/cf/*.cf
    rm -fr %{buildroot}%{_datadir}/sendmail/*/*~ ${doc}/*~
    find %{buildroot}%{_datadir}/sendmail/ ${doc}/ %{buildroot}%{_includedir}/ \
					-name '*.ldap' -o -name '*.mime' -o \
					-name '*.mrbl' -o -name '*.util' -o \
					-name '*.dif'  -o -name '*.orig' | xargs -r rm -f
    cd suse/
    # etc/aliases and %{_sysconfdir}/aliases.d are in other packages
    #install -m 0644 aliases %{buildroot}%{_sysconfdir}/
    #install -d -m 0750 %{buildroot}%{_sysconfdir}/aliases.d
    install -m 0644 README Makefile mailertable genericstable userdb domaintable \
		    virtusertable access linux.mc linux.submit.mc \
		    linux.nullclient.mc service-nodns.switch \
		    service.switch relay-domains trusted-users \
		    local-host-names %{buildroot}%{_mailcnfdir}/
    install -m 0600 auth-info %{buildroot}%{_mailcnfdir}/auth/
    install -m 0755 sendmail.nissl %{buildroot}%{_sbindir}/
    install -m 0644 permissions %{buildroot}%{_sysconfdir}/permissions.d/sendmail
    install -m 0644 permissions.paranoid %{buildroot}%{_sysconfdir}/permissions.d/sendmail.paranoid
    install -m 0755 rc   %{buildroot}%{_sysconfdir}/init.d/sendmail
    install -m 0644 smtp %{buildroot}%{_sysconfdir}/pam.d/smtp
    install -m 0644 fw   %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/sendmail
    install SuSEconfig.sendmail %{buildroot}/sbin/conf.d/
    install -m 0644 sysconfig.sendmail      %{buildroot}%{_localstatedir}/adm/fillup-templates/
    install -m 0644 sysconfig.mail-sendmail %{buildroot}%{_localstatedir}/adm/fillup-templates/
    > ${doc}/README.sendmail-local-only
    for m in messages/sendmail-local-only*; do
	l=${m##*.}
	n=${m##*/}
	n=${n%.*}
	cat $m >> ${doc}/README.sendmail-local-only
	echo   >> ${doc}/README.sendmail-local-only
    done
    cd ../
    if test -n "%{buildroot}" ; then
	cat %{buildroot}%{_mailcnfdir}/linux.mc		| \
	sed "s@include(\`@include(\`%{buildroot}@"	| \
	m4 | \
	sed "s@%{buildroot}@@g"	> %{buildroot}%{_sysconfdir}/sendmail.cf
	cat %{buildroot}%{_mailcnfdir}/linux.submit.mc	| \
	sed "s@include(\`@include(\`%{buildroot}@"	| \
	m4 | \
	sed "s@%{buildroot}@@g"	> %{buildroot}%{_mailcnfdir}/submit.cf
    else
	m4 < %{_mailcnfdir}/linux.mc		> %{_sysconfdir}/sendmail.cf
	m4 < %{_mailcnfdir}/linux.submit.mc	> %{_mailcnfdir}/submit.cf
    fi
    ln -sf %{_sysconfdir}/init.d/sendmail %{buildroot}%{_sbindir}/rcsendmail
    ln -sf ../aliases  %{buildroot}%{_mailcnfdir}/aliases
    pushd %{buildroot}%{_mailcnfdir}/
	OPATH=$PATH
	PATH="${OPATH}:%{buildroot}%{_sbindir}:%{buildroot}%{_bindir}"
	make DESTDIR=%{buildroot} short
	PATH=$OPATH
    popd
    #
    # Remove some files we don't wish to package
    #
    rm -f %{buildroot}%{_sysconfdir}/aliases %{buildroot}%{_mailcnfdir}/*.db
    rm -f %{buildroot}%{_mailcnfdir}/*/*.db

%clean
rm -rf %{buildroot}

%pre
# Check for rc.config: 
if test -f etc/rc.config ; then
  SMTP=$(. etc/rc.config 2>/dev/null; echo $SMTP)
  if test -n "$SMTP" ; then
    echo SMTP=$SMTP > var/adm/run-sendmail
  fi
fi

%post
# Trigger rebuild of old db's
for db in etc/aliases.db etc/aliases.d/*.db etc/mail/*.db etc/mail/*/*.db ; do
  test -e "$db"       || continue
  test -e "${db%.db}" || continue
  touch "${db%.db}"
done
# Put together
if test -f etc/rc.config.d/sendmail.rc.config ; then
  cat etc/rc.config.d/sendmail.rc.config >> etc/rc.config
  rm -f etc/rc.config.d/sendmail.rc.config
fi
# Rename these on update
if test -f etc/rc.config ; then
  SENDMAIL_ARGS=$(. etc/rc.config 2>/dev/null; echo $SENDMAIL_ARGS)
  case "$SENDMAIL_ARGS" in
    *-L*-Am*) ;;
    *-Am*-L*) ;;
    *) SENDMAIL_ARGS="-L sendmail -Am $SENDMAIL_ARGS"
  esac
  sed -e "s@^SENDMAIL_TYPE=@MAIL_CREATE_CONFIG=@" \
    -e "s@^SENDMAIL_NODNS=@NODNS=@" \
    -e "s@^SENDMAIL_ARGS=.*@SENDMAIL_ARGS=\"$SENDMAIL_ARGS\"@" \
    -e "s@^SENDMAIL_DIALUP=@DIALUP=@" etc/rc.config > etc/rc.config.new
  test -s etc/rc.config.new && mv etc/rc.config.new etc/rc.config || true
fi
# Should we listen for remote mails
if test -f var/adm/run-sendmail ; then
  . var/adm/run-sendmail
  if test "$SMTP" = "yes" -a -f var/adm/fillup-templates/sysconfig.mail-sendmail ; then
    sed -e 's@SMTPD_LISTEN_REMOTE="no"@SMTPD_LISTEN_REMOTE="yes"@' \
	  var/adm/fillup-templates/sysconfig.mail-sendmail \
	> var/adm/fillup-templates/sysconfig.mail-sendmail.new
    test -s var/adm/fillup-templates/sysconfig.mail-sendmail.new &&
         mv var/adm/fillup-templates/sysconfig.mail-sendmail.new \
            var/adm/fillup-templates/sysconfig.mail-sendmail || true
    SMTPD_LISTEN_REMOTE=yes
  fi
fi
# Update from newer SuSE releases or new installation
if test -f etc/sysconfig/mail ; then
  . etc/sysconfig/mail
fi
%{fillup_and_insserv -nY sendmail sendmail}
%{fillup_only -an mail}

%preun
%{stop_on_removal sendmail}

%postun
%{restart_on_update sendmail}
%{insserv_cleanup}

%files -f file-list
%defattr(-,root,root)
%dir %{_mailcnfdir}
# %{_sysconfdir}/aliases.d is part of aaa_dir
# %dir %attr(0750,root,mail) %{_sysconfdir}/aliases.d
%dir %attr(0750,root,root) %{_mailcnfdir}/auth
%dir %attr(0750,root,root) %{_mailcnfdir}/certs
%config(noreplace) %{_sysconfdir}/sendmail.cf
# %{_sysconfdir}/aliases is part of netcfg
# %config(noreplace) %{_sysconfdir}/aliases
%doc               %{_mailcnfdir}/README
%config(noreplace) %{_mailcnfdir}/Makefile
# this is a link
%config(noreplace) %{_mailcnfdir}/aliases
%config(noreplace) %attr(0600,root,root) %{_mailcnfdir}/auth/auth-info
%config(noreplace) %{_mailcnfdir}/linux.mc
%config(noreplace) %{_mailcnfdir}/linux.submit.mc
%config(noreplace) %{_mailcnfdir}/linux.nullclient.mc
%config(noreplace) %{_mailcnfdir}/mailertable
%config(noreplace) %{_mailcnfdir}/genericstable
%config(noreplace) %{_mailcnfdir}/domaintable
%config(noreplace) %{_mailcnfdir}/virtusertable
%config(noreplace) %{_mailcnfdir}/access
%config(noreplace) %{_mailcnfdir}/userdb
%config(noreplace) %{_mailcnfdir}/relay-domains
%config(noreplace) %{_mailcnfdir}/service.switch
%config(noreplace) %{_mailcnfdir}/service-nodns.switch
%config(noreplace) %{_mailcnfdir}/trusted-users
%config(noreplace) %{_mailcnfdir}/local-host-names
%config(noreplace) %{_mailcnfdir}/submit.cf
%doc %{_defaultdocdir}/sendmail
%{_datadir}/sendmail
%{_localstatedir}/adm/fillup-templates/sysconfig.sendmail
%{_localstatedir}/adm/fillup-templates/sysconfig.mail-sendmail
%config %attr(0644,root,root) %{_sysconfdir}/pam.d/smtp
%config %attr(0644,root,root) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/sendmail
%config %attr(0744,root,root) %{_sysconfdir}/init.d/sendmail
%config %attr(0755,root,root) /sbin/conf.d/SuSEconfig.sendmail
%{_bindir}/hoststat
%{_bindir}/mailq
%{_bindir}/newaliases
%{_bindir}/praliases
%{_bindir}/purgestat
#%{_bindir}/rmail
%{_prefix}/lib/sendmail
%dir %attr(0755,root,root) %{_prefix}/lib/sendmail.d/
%dir %attr(0755,root,root) %{_prefix}/lib/sendmail.d/bin/
%{_prefix}/lib/sendmail.d/bin/mail
%attr(0511,root,root) %{_prefix}/lib/sendmail.d/bin/mail.local
%{_prefix}/lib/sendmail.d/bin/procmail
%attr(0511,root,root) %{_prefix}/lib/sendmail.d/bin/smrsh
%{_prefix}/lib/sendmail.d/bin/vacation
%{_prefix}/lib/sendmail.d/helpfile
%doc %{_mandir}/man1/mailq.1.gz
%doc %{_mandir}/man1/newaliases.1.gz
%doc %{_mandir}/man5/aliases.5.gz
%doc %{_mandir}/man8/editmap.8.gz
%doc %{_mandir}/man8/makemap.8.gz
#%doc %{_mandir}/man8/rmail.8.gz
%doc %{_mandir}/man8/sendmail.8.gz
%doc %{_mandir}/man8/smrsh.8.gz
%doc %{_mandir}/man8/mail.local.8.gz
%doc %{_mandir}/man8/mailstats.8.gz
%doc %{_mandir}/man8/praliases.8.gz
%{_sbindir}/editmap
%{_sbindir}/mailstats
%{_sbindir}/makemap
# Should we do 6555??
%attr(2555,root,mail) %{_sbindir}/sendmail
%{_sbindir}/sendmail.nissl
%{_sbindir}/rcsendmail

%files -n sendmail-devel
%defattr(-,root,root)
%dir %{_includedir}/libmilter
%{_includedir}/libmilter/*.h
%dir %{_includedir}/sm
%{_includedir}/sm/*.h
%dir %{_includedir}/sm/os
%{_includedir}/sm/os/*.h
%{_libdir}/libmilter.a
%{_libdir}/libsmutil.a
%{_libdir}/libsm.a

%files -n rmail
%defattr(-,root,root)
%{_bindir}/rmail
%doc %{_mandir}/man8/rmail.8.gz

%changelog
openSUSE Build Service is sponsored by