NetBSD/gnu/dist/postfix/auxiliary/MacOSX/activate-postfix

62 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# Written by Gerben Wierda, Oct 2001. I waive every copyright on this and
# I also do not give any warranty.
. ./defines
if [ ! -e ${POSTFIXBACKUPDIR}/sendmail ]
then
echo "Something is wrong: there is no existing postfix binary backup"
exit 1;
else
echo "Restoring postfix versions of sendmail programs from backup..."
(cd ${POSTFIXBACKUPDIR}; tar cf - sendmail) | (cd /usr/sbin; tar xf -)
(cd ${POSTFIXBACKUPDIR}; tar cf - newaliases) | (cd /usr/bin; tar xf -)
(cd ${POSTFIXBACKUPDIR}; tar cf - mailq) | (cd /usr/bin; tar xf -)
fi
if [ -e "${PSI}" ]
then
echo "Postfix StartupItem already exists."
else
if [ -e "${PSIDISABLED}" ]
then
echo "Reinstating disabled Postfix StartupItem..."
mv "${PSIDISABLED}" "${PSI}"
else
echo "Installing new default Postfix StartupItem..."
cp -R Postfix.StartupItem "${PSI}"
fi
fi
if [ -e "${SSI}" ]
then
if [ ! -d "${SIDISABLEDDIR}" ]
then
mkdir -p "${SIDISABLEDDIR}"
fi
echo "Moving existing Sendmail StartupItem to ${SIDISABLEDDIR}..."
if [ -e "${SSIDISABLED}" ]
then
echo "Something is wrong. A disabled Sendmail StartupItem already exists."
DATETIME=`date +"%Y%b%e-%H%M%S"`
echo "Moving Sendmail to Sendmail.${DATETIME}"
mv "${SSI}" "${SSIDISABLED}.${DATETIME}"
echo "You should have just one ${SSIDISABLED}"
else
mv "${SSI}" "${SSIDISABLED}"
fi
fi
. /etc/hostconfig
if [ "${MAILSERVER:=-NO-}" = "-YES-" ]
then
echo "Postfix will start on reboot"
else
echo "Note: Postfix needs MAILSERVER set to -YES- in /etc/hostconfig"
echo "Postfix will NOT start on reboot"
fi