NetBSD/share/sushi/system/mailerconf/script

69 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
# $NetBSD: script,v 1.1 2001/03/06 21:21:06 garbled Exp $
MAILERCONF="/etc/mailer.conf"
if [ "$1" = "sendmail" ]; then
grep sendmail/sendmail $MAILERCONF >/dev/null
if [ "$?" = "0" ]; then
echo "Sendmail is allready your default mailer"
exit 0
fi
echo "sendmail /usr/libexec/sendmail/sendmail" >$MAILERCONF
echo "send-mail /usr/libexec/sendmail/sendmail" >>$MAILERCONF
echo "mailq /usr/libexec/sendmail/sendmail" >>$MAILERCONF
echo "newaliases /usr/libexec/sendmail/sendmail" >>$MAILERCONF
echo "hoststat /usr/libexec/sendmail/sendmail" >>$MAILERCONF
echo "purgestat /usr/libexec/sendmail/sendmail" >>$MAILERCONF
echo "Sendmail has now been made your default mailer."
chown root:wheel $MAILERCONF
chmod 644 $MAILERCONF
exit 0
fi
if [ "$1" = "postfix" ]; then
grep postfix/sendmail $MAILERCONF >/dev/null
if [ "$?" = "0" ]; then
echo "Postfix is allready your default mailer"
exit 0
fi
echo "sendmail /usr/libexec/postfix/sendmail" >$MAILERCONF
echo "send-mail /usr/libexec/postfix/sendmail" >>$MAILERCONF
echo "mailq /usr/libexec/postfix/sendmail" >>$MAILERCONF
echo "newaliases /usr/libexec/postfix/sendmail" >>$MAILERCONF
echo "Postfix has now been made your default mailer."
chown root:wheel $MAILERCONF
chmod 644 $MAILERCONF
exit 0
fi
if [ "$1" = "exim" ]; then
PKGNM=`pkg_info -e exim`
LOCALBASE=`pkg_info -p $PKGNM | grep CWD | sed -e 's@.*CWD to: @@'`
cp $LOCALBASE/etc/exim/mailer.conf.exim $MAILERCONF
chown root:wheel $MAILERCONF
chmod 644 $MAILERCONF
echo "$PKGNM has now been made your default mailer"
exit 0
fi
if [ "$1" = "postfix-current" ]; then
PKGNM=`pkg_info -e postfix-current`
LOCALBASE=`pkg_info -p $PKGNM | grep CWD | sed -e 's@.*CWD to: @@'`
cp $LOCALBASE/etc/mailer.conf.postfix $MAILERCONF
chown root:wheel $MAILERCONF
chmod 644 $MAILERCONF
echo "$PKGNM has now been made your default mailer"
exit 0
fi
if [ "$1" = "sendmail88" ]; then
PKGNM=`pkg_info -e sendmail88`
LOCALBASE=`pkg_info -p $PKGNM | grep CWD | sed -e 's@.*CWD to: @@'`
cp $LOCALBASE/etc/mailer.conf.sendmail $MAILERCONF
chown root:wheel $MAILERCONF
chmod 644 $MAILERCONF
echo "$PKGNM has now been made your default mailer"
exit 0
fi