#!/bin/sh
# $NetBSD: script1,v 1.4 2005/01/18 18:12:55 peter Exp $

BIGLIST="exim postfix-current sendmail88"
MAILERCONF="/etc/mailer.conf"

sendmail=0
grep sendmail/sendmail $MAILERCONF >/dev/null
if [ $? -eq 0 ]; then
	grep "^#.*sendmail/sendmail" $MAILERCONF >/dev/null
	if [ $? -ne 0 ]; then
		sendmail=1
	fi
fi

postfix=0
grep postfix/sendmail $MAILERCONF >/dev/null
if [ $? -eq 0 ]; then
	grep "^#.*postfix/sendmail" $MAILERCONF >/dev/null
	if [ $? -ne 0 ]; then
		postfix=1
	fi
fi

if [ $postfix -eq 1 ]; then
	echo "postfix"
	echo "sendmail"
else
	echo "sendmail"
	echo "postfix"
fi

for i in $BIGLIST
do
	pkg_info -e $i >/dev/null
	if [ $? -eq 0 ]; then
		echo "$i"
	fi
done
