# $Id: postinstall,v 1.2 2003/05/19 21:50:10 elkner Exp $

PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH

if [ -z "${PKG_INSTALL_ROOT}" ]; then
	BASE=$CLIENT_BASEDIR
	ROOT=/
else
	BASE=${PKG_INSTALL_ROOT}$CLIENT_BASEDIR
	ROOT=${PKG_INSTALL_ROOT}
fi

# solaris test does not know a '-e' switch - so we use -h && -f 

if [ -f ${ROOT}/etc/mail/submit.cf -o -h ${ROOT}/etc/mail/submit.cf ]; then
	echo " "
	echo "/etc/mail/submit.cf exists. If you want to replace it with"
	echo "the new version, copy /etc/mail/submit.cf.default to"
	echo "/etc/mail/submit.cf. This is recommended!"
else
	cp -p ${ROOT}/etc/mail/submit.cf.default ${ROOT}/etc/mail/submit.cf
	chmod 0644 ${ROOT}/etc/mail/submit.cf
fi

if [ -f ${ROOT}/etc/mail/sendmail.cf -o -h ${ROOT}/etc/mail/sendmail.cf ]; then
	echo " "
	echo "/etc/mail/sendmail.cf exists. Make sure, that it is uptodate!"
else
	cp -p ${ROOT}/etc/mail/sendmail.cf.default ${ROOT}/etc/mail/sendmail.cf
	chmod 0644 ${ROOT}/etc/mail/sendmail.cf
fi


if [ ! -f ${ROOT}/etc/mail/aliases -a ! -h ${ROOT}/etc/mail/aliases ]; then
	cp -p ${ROOT}/etc/mail/aliases.default ${ROOT}/etc/mail/aliases
	chmod 0644 ${ROOT}/etc/mail/aliases
fi
if [ ! -r ${ROOT}/etc/mail/local-host-names ]; then
	: >${ROOT}/etc/mail/local-host-names
	chmod 644 ${ROOT}/etc/mail/local-host-names
fi
if [ ! -f ${ROOT}/etc/mail/trusted-users ]; then
	echo 'root' >${ROOT}/etc/mail/trusted-users
	chmod 644 ${ROOT}/etc/mail/trusted-users
fi

if [ ! -f ${ROOT}/var/log/sendmail.st -a ! -h ${ROOT}/var/log/sendmail.st ]; then
	: >${ROOT}/var/log/sendmail.st
	chmod 644 ${ROOT}/var/log/sendmail.st
fi

echo " "
echo "To create a new sendmail.cf for a client, you may execute the script"
echo "/etc/mail/mknewcf. If you want to create a sendmail.cf for a central"
echo "mail server, you should adjust the settings in /etc/mail/server.mc"
echo "and execute /etc/mail/mknewcf -s."
echo " "

