SPECS/sendmail/sendmail.spec
f0971244
 Summary:        Commonly used Mail transport agent (MTA)
 Name:           sendmail
 Version:        8.15.2
d9cb2d39
 Release:        6%{?dist}
f0971244
 URL:            http://www.sendmail.org/
 License:        GPLv2+ and GPLv3+ and LGPLv2+
 Group:          Email/Server/Library
 Vendor:         VMware, Inc.
 Distribution:   Photon
 Source0:        http://ftp.vim.org/pub/mail/sendmail/sendmail-r8/sendmail.8.15.2.tar.gz
9f22384d
 BuildRequires:	systemd
f0971244
 BuildRequires:  openldap
 BuildRequires:  openssl-devel
 BuildRequires:  db-devel
 BuildRequires:  shadow
9f22384d
 Requires:       systemd
b3f8d3b3
 Requires:       m4
 Requires:       openldap
f0971244
 
 %define sha1 sendmail=5801d4b06f4e38ef228a5954a44d17636eaa5a16
 
 %description
 Sendmail is widely used Mail Transport agent which helps in sending 
 email from one system to another. This program helps in movement 
 of email from systems to network and is not just a mail client.
 
 %prep
 
 %setup 
 
 %build
 
 cat >> devtools/Site/site.config.m4 << "EOF"
 APPENDDEF(`confENVDEF',`-DSTARTTLS -DSASL -DLDAPMAP')
 APPENDDEF(`confLIBS', `-lssl -lcrypto -lsasl2 -lldap -llber -ldb')
 APPENDDEF(`confINCDIRS', `-I/usr/include/sasl')
 APPENDDEF(`confLIBS', `-lresolv')
 define(`confMANGRP',`root')
 define(`confMANOWN',`root')
 define(`confSBINGRP',`root')
 define(`confUBINGRP',`root')
 define(`confUBINOWN',`root')
 EOF
 
 sed -i 's|/usr/man/man|/usr/share/man/man|' \
     devtools/OS/Linux           &&
 
 cd sendmail                     &&
 sh Build                        &&
 cd ../cf/cf                     &&
 cp generic-linux.mc sendmail.mc &&
 sh Build sendmail.cf
 
 %install
 groupadd -g 26 smmsp &&
 useradd -c "Sendmail Daemon" -g smmsp -d /dev/null \
         -s /bin/false -u 26 smmsp                  &&
 
 cd cf/cf
 install -v -d -m755 %{buildroot}/etc/mail &&
 sh Build DESTDIR=%{buildroot} install-cf &&
 
 cd ../..            &&
 install -v -d -m755 %{buildroot}/usr/bin &&
 install -v -d -m755 %{buildroot}/usr/sbin &&
 install -v -d -m755 %{buildroot}/usr/share/man/man1 &&
 install -v -d -m755 %{buildroot}/usr/share/man/man8 &&
 sh Build DESTDIR=%{buildroot} install    &&
 
 install -v -m644 cf/cf/{submit,sendmail}.mc %{buildroot}/etc/mail &&
 cp -v -R cf/* %{buildroot}/etc/mail                               &&
 
 install -v -m755 -d %{buildroot}/usr/share/doc/sendmail-8.15.2/{cf,sendmail} &&
 
 install -v -m644 CACerts FAQ KNOWNBUGS LICENSE PGPKEYS README RELEASE_NOTES \
         %{buildroot}/usr/share/doc/sendmail-8.15.2 &&
 
 install -v -m644 sendmail/{README,SECURITY,TRACEFLAGS,TUNING} \
         %{buildroot}/usr/share/doc/sendmail-8.15.2/sendmail &&
 
 install -v -m644 cf/README %{buildroot}/usr/share/doc/sendmail-8.15.2/cf &&
 
 for manpage in sendmail editmap mailstats makemap praliases smrsh
 do
     install -v -m644 ${manpage}/${manpage}.8 %{buildroot}/usr/share/man/man8
 done &&
 
 install -v -m644 sendmail/aliases.5    %{buildroot}/usr/share/man/man5 &&
 install -v -m644 sendmail/mailq.1      %{buildroot}/usr/share/man/man1 &&
 install -v -m644 sendmail/newaliases.1 %{buildroot}/usr/share/man/man1 &&
 install -v -m644 vacation/vacation.1   %{buildroot}/usr/share/man/man1
 
 mkdir -p %{buildroot}/etc/systemd/system/
 mkdir -p %{buildroot}/etc/sysconfig/
 
 cat > %{buildroot}/etc/sysconfig/sendmail <<- "EOF"
 DAEMON=yes
 QUEUE=1h
 
 EOF
 
 
 cat > %{buildroot}/etc/systemd/system/sendmail.service <<- "EOF"
 [Unit]
 Description=Sendmail Mail Transport Agent
 After=syslog.target network.target
 
 [Service]
 Environment=QUEUE=1h
 EnvironmentFile=/etc/sysconfig/sendmail
 Type=forking
 ExecStart=/usr/sbin/sendmail -bd -q $QUEUE $SENDMAIL_OPTARG
 
 [Install]
 WantedBy=multi-user.target
 
 EOF
 
 %pre
 groupadd -g 26 smmsp                               &&
 useradd -c "Sendmail Daemon" -g smmsp -d /dev/null \
         -s /bin/false -u 26 smmsp                  &&
 chmod -v 1777 /var/mail                            &&
 install -v -m700 -d /var/spool/mqueue
 
 
 %post
9f22384d
 if [ $1 -eq 1 ] ; then
b3f8d3b3
   echo $(hostname -f) > /etc/mail/local-host-names
9f22384d
   cat > /etc/mail/aliases << "EOF"
b3f8d3b3
 postmaster: root
 MAILER-DAEMON: root
 EOF
9f22384d
   /bin/newaliases
f0971244
 
9f22384d
   cd /etc/mail
   m4 m4/cf.m4 sendmail.mc > sendmail.cf
f0971244
 
9f22384d
   chmod 700 /var/spool/clientmqueue
   chown smmsp:smmsp /var/spool/clientmqueue
 fi
f0971244
 
9f22384d
 %systemd_post sendmail.service
f0971244
 
 %preun
9f22384d
 %systemd_preun sendmail.service
f0971244
 
 
 %postun
9f22384d
 if [ $1 -eq 0 ] ; then
   userdel smmsp
   groupdel smmsp
f0971244
 
9f22384d
   rm -rf /etc/mail
 fi
d9cb2d39
 %systemd_postun_with_restart sendmail.service
f0971244
 
 %files
 %{_sysconfdir}/*
 /usr/*
 /var/*
 /etc/systemd/system/sendmail.service
 /etc/sysconfig/sendmail
 
 %exclude /usr/lib/debug
 %exclude /usr/src
 %exclude /usr/share/man/*
 
 
 %changelog
d9cb2d39
 *       Thu May 26 2016 Divya Thaluru <dthaluru@vmware.com> 8.15.2-6
 -       Fixed logic to restart the active services after upgrade 
b3f8d3b3
 *       Wed May 25 2016 Kumar Kaushik <kaushikk@vmware.com> 8.15.2-5
 -       Adding dependencies and fixing post section installation bug.
922219c1
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 8.15.2-4
 -	GA - Bump release of all rpms
9f22384d
 *   	Wed May 4 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 8.15.2-3
 -   	Fix for upgrade issues
020422ab
 *       Wed Feb 17 2016 Kumar Kaushik <kaushikk@vmware.com> 8.15.2-2
 -       Changing permission and owner of clientmqueue.
f0971244
 *       Tue Jan 05 2016 Kumar Kaushik <kaushikk@vmware.com> 8.15.2-1
 -       Initial build.  First version