PREIN
/bin/sh
/usr/sbin/useradd -u 47 -d /var/spool/mqueue -r -s /sbin/nologin mailnull >/dev/null 2>&1
/usr/sbin/useradd -u 51 -d /var/spool/mqueue -r -s /sbin/nologin smmsp >/dev/null 2>&1
exit 0
PREUN
/bin/sh
if [ $1 = 0 ]; then
/etc/rc.d/init.d/sendmail stop >/dev/null 2>&1
/sbin/chkconfig --del sendmail
/usr/sbin/alternatives --remove mta /usr/sbin/sendmail.sendmail
fi
exit 0
POSTIN
/bin/sh
#
# 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
#
# Remove deprecated config flags which are probably harmless to remove
#
cf=`/bin/mktemp /etc/mail/sendmail.cf.XXXXXX`
if [ "$cf" != "" ] ; then
sed 's/^O AutoRebuildAliases$/#&/g' /etc/mail/sendmail.cf > ${cf} && \
touch -r /etc/mail/sendmail.cf ${cf}
cat ${cf} > /etc/mail/sendmail.cf
touch -r ${cf} /etc/mail/sendmail.cf
rm ${cf}
fi
/sbin/chkconfig --add sendmail
#
# Set up the alternatives files for MTAs.
#
/usr/sbin/alternatives --install /usr/sbin/sendmail mta /usr/sbin/sendmail.sendmail 90 \
--slave /usr/bin/mailq mta-mailq /usr/bin/mailq.sendmail \
--slave /usr/bin/newaliases mta-newaliases /usr/bin/newaliases.sendmail \
--slave /usr/bin/rmail mta-rmail /usr/bin/rmail.sendmail \
--slave /usr/lib/sendmail mta-sendmail /usr/lib/sendmail.sendmail \
--slave /etc/pam.d/smtp mta-pam /etc/pam.d/smtp.sendmail \
--slave /usr/share/man/man8/sendmail.8.gz mta-sendmailman /usr/share/man/man8/sendmail.sendmail.8.gz \
--slave /usr/share/man/man1/mailq.1.gz mta-mailqman /usr/share/man/man1/mailq.sendmail.1.gz \
--slave /usr/share/man/man1/newaliases.1.gz mta-newaliasesman /usr/share/man/man1/newaliases.sendmail.1.gz \
--slave /usr/share/man/man5/aliases.5.gz mta-aliasesman /usr/share/man/man5/aliases.sendmail.5.gz \
--initscript sendmail
#
# 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)
#
{
chown root /etc/aliases.db /etc/mail/access.db /etc/mail/mailertable.db \
/etc/mail/domaintable.db /etc/mail/virtusertable.db
/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}
fi
done
} > /dev/null 2>&1
POSTUN
/bin/sh
if [ "$1" -ge "1" ]; then
/etc/rc.d/init.d/sendmail condrestart >/dev/null 2>&1
mta=`readlink /etc/alternatives/mta`
if [ "$mta" == "/usr/sbin/sendmail.sendmail" ]; then
/usr/sbin/alternatives --set mta /usr/sbin/sendmail.sendmail
fi
fi
exit 0
Triggers
sendmail <
8.10.0
/bin/sh
/sbin/chkconfig --add sendmail
sendmail <
8.11.6-11
/bin/sh
/usr/sbin/alternatives --auto mta