[Exim] Hose your FreeBSD system!

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Oliver Eikemeier
Fecha:  
A: exim-users
Cc: Mark Foster
Temas antiguos: Re: [Exim] exim port (freebsd) documentation issue
Temas nuevos: Re: [Exim] exim port (freebsd) documentation issue
Asunto: [Exim] Hose your FreeBSD system!
Oops!...I Did It Again:

--- eximswitch.sh begins here ---
#!/bin/sh -e
#
#   eximswitch.sh
#
# Make exim the default MTA on a FreeBSD 4.x/5.x system
#
# Written by Oliver Eikemeier <eikemeier@???>
# Version 2003-09-26
#
# use only if:
# 1) Exim is fully configured
# 2) you have read and understood
#    rc.conf(5), mailer.conf(8), newsyslog(8), periodic.conf(5)
#
# studying the documentation in
#   /usr/local/share/doc/exim
# is highly recommended
#
# An online guide is at
#  <http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mail-changingmta.html>
#
# Happy mailing, and buy the book: <http://www.uit.co.uk/exim-book>
#


if [ -r /etc/defaults/rc.conf ]; then
    . /etc/defaults/rc.conf
    source_rc_confs
elif [ -r /etc/rc.conf ]; then
    . /etc/rc.conf
fi


exim_program=${exim_program:-/usr/local/sbin/exim}

sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}

if [ ! -x ${exim_program} ];then
    echo "Exim is not installed!"
    exit 1;
fi


if [ -r ${sendmail_pidfile} ]; then
    echo "killing sendmail"
    kill -TERM `head -1 ${sendmail_pidfile}`
fi


if [ -r ${sendmail_mspq_pidfile} ]; then
    echo "killing sendmail-clientmqueue"
    kill -TERM `head -1 ${sendmail_mspq_pidfile}`
fi



today=`date`
begin_eximswitch="# --- begin eximswitch generated ${today} ---"
end_eximswitch="# --- end eximswitch generated ${today} ---"

osversion=`/sbin/sysctl -n kern.osreldate`

if [ ${osversion} -lt 500000 -a ${osversion} -ge 480101 \
    -o ${osversion} -ge 500105 ]; then
  newsyslog_nohup=N
fi


if [ ${osversion} -lt 500000 -a ${osversion} -ge 460101 \
    -o ${osversion} -ge 500036 ]; then
  reinplace=sed
else
  reinplace=sed_inplace
fi


for conf in periodic newsyslog mail/mailer rc; do
    if grep -qs '^# ---.*eximswitch' /etc/${conf}.conf; then
        echo "\`${conf}.conf' is already configured, remove with:"
        if [ "${conf}" != "mail/mailer" ]; then
            echo -n "  ${reinplace} -i .bak -e '/^# --- begin eximswitch/,"
            echo "/^# --- end eximswitch/d' /etc/${conf}.conf"
        else
            echo "  mv /etc/mail/mailer.conf.bak /etc/mail/mailer.conf"
        fi
    else
        echo "modifying \`${conf}.conf'"
        case ${conf} in
        periodic)
            cat <<- _PERIODIC_CONF >> /etc/periodic.conf
            ${begin_eximswitch}
            daily_clean_hoststat_enable="NO"
            daily_status_mailq_shorten="NO"
            daily_status_include_submit_mailq="NO"
            daily_status_mail_rejects_enable="NO"
            daily_submit_queuerun="NO"
            ${end_eximswitch}
            _PERIODIC_CONF
            ;;
        newsyslog)
            cat <<- _NEWSYSLOG_CONF >> /etc/newsyslog.conf
            ${begin_eximswitch}
            /var/log/exim/mainlog    mailnull:mail    640  7       *    @T00  Z${newsyslog_nohup:-}
            /var/log/exim/rejectlog    mailnull:mail    640  3       *    \$W6D0 Z${newsyslog_nohup:-}
            ${end_eximswitch}
            _NEWSYSLOG_CONF
            ;;
        mail/mailer)
            mv /etc/mail/mailer.conf /etc/mail/mailer.conf.bak
            cat <<- _MAILER_CONF >> /etc/mail/mailer.conf
            ${begin_eximswitch}
            sendmail    ${exim_program}
            send-mail    ${exim_program}
            mailq        ${exim_program}
            newaliases    ${exim_program}
            hoststat    /usr/bin/true
            purgestat    /usr/bin/true
            ${end_eximswitch}
            _MAILER_CONF
            ;;
        rc)
            cat <<- _RC_CONF >> /etc/rc.conf
            ${begin_eximswitch}
            sendmail_enable="NONE"
            sendmail_program="${exim_program}"
            sendmail_flags="-bd -q30m"
            mta_start_script=""
            exim_enable="YES"
            ${end_eximswitch}
            _RC_CONF
            ;;
        esac
    fi
    echo
done


echo 'finished.'
--- eximswitch.sh ends here ---

And because the mailing list seems to loose too:

MD5 (eximswitch.sh) = f4a406aa09b57d030975cee596c4fad4

[ Deleted uuencoded file 'eximswitch.sh.g' ]

Happy hosing
    Oliver