2000-08-12 19:57:45 -04:00
|
|
|
#!/bin/sh
|
2004-07-26 06:56:01 -04:00
|
|
|
# $OpenBSD: INSTALL,v 1.3 2004/07/26 10:56:01 peter Exp $
|
2000-08-12 19:57:45 -04:00
|
|
|
#
|
|
|
|
# Pre/post-installation setup of exim
|
|
|
|
|
2004-07-26 06:56:01 -04:00
|
|
|
# use a sane path and install prefix
|
2000-08-12 19:57:45 -04:00
|
|
|
#
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
|
|
PREFIX=${PKG_PREFIX:-/usr/local}
|
|
|
|
CONFIG_DIR=${SYSCONFDIR}/exim
|
|
|
|
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/exim
|
|
|
|
|
2004-07-26 06:56:01 -04:00
|
|
|
EXIMSPOOL=/var/spool/exim
|
|
|
|
EXIM=_exim
|
|
|
|
ID=521
|
|
|
|
|
|
|
|
# add user/group _exim if they don't already exist
|
|
|
|
do_accts()
|
|
|
|
{
|
|
|
|
echo
|
|
|
|
echo "+---------------------"
|
|
|
|
|
|
|
|
groupinfo -e $EXIM
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "| Using existing group '$EXIM'"
|
|
|
|
else
|
|
|
|
echo "| Creating group '$EXIM'"
|
|
|
|
groupadd -g $ID $EXIM
|
|
|
|
fi
|
|
|
|
|
|
|
|
userinfo -e $EXIM
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "| Using existing account '$EXIM'"
|
|
|
|
else
|
|
|
|
echo "| Creating user '$EXIM'"
|
|
|
|
if [ -d $EXIMSPOOL ]; then
|
|
|
|
EXIMCREATEHOME=""
|
|
|
|
else
|
|
|
|
EXIMCREATEHOME="-m"
|
|
|
|
fi
|
|
|
|
useradd -g $EXIM \
|
|
|
|
-c "$1 Account" \
|
|
|
|
$EXIMCREATEHOME -d $EXIMSPOOL \
|
|
|
|
-L daemon \
|
|
|
|
-u $ID $EXIM
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "+---------------------"
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2000-08-12 19:57:45 -04:00
|
|
|
# Function: tell the user what they need to do to use the port just installed
|
|
|
|
#
|
|
|
|
do_notice()
|
|
|
|
{
|
2004-07-26 06:56:01 -04:00
|
|
|
echo
|
|
|
|
echo "+---------------"
|
|
|
|
echo "| If you intend replacing sendmail with exim, then don't"
|
|
|
|
echo "| forget to modify /etc/mailer.conf accordingly; see"
|
|
|
|
echo "| mailwrapper(8)."
|
2000-08-12 19:57:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function: install configuration files
|
|
|
|
#
|
|
|
|
do_install_conf()
|
|
|
|
{
|
2004-07-26 06:56:01 -04:00
|
|
|
install -d -o root -g wheel ${CONFIG_DIR}
|
|
|
|
install -o root -g wheel ${SAMPLE_CONFIG_DIR}/configure \
|
|
|
|
${CONFIG_DIR}/configure
|
|
|
|
echo "| "
|
|
|
|
echo "| A default $1 configuration file has been installed"
|
|
|
|
echo "| in ${CONFIG_DIR}."
|
|
|
|
echo "|"
|
|
|
|
echo "| Please review this file and change the configuration"
|
|
|
|
echo "| to meet your needs."
|
|
|
|
echo "+---------------"
|
|
|
|
echo
|
2000-08-12 19:57:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function: tell the user what they need to do to use the port just installed
|
|
|
|
#
|
|
|
|
do_notice_conf()
|
|
|
|
{
|
2004-07-26 06:56:01 -04:00
|
|
|
echo "| "
|
|
|
|
echo "| The existing $1 configuration files in ${CONFIG_DIR} have NOT"
|
|
|
|
echo "| been changed. You may want to compare them to the current samples"
|
|
|
|
echo "| in ${SAMPLE_CONFIG_DIR}, and update your configuration files"
|
|
|
|
echo "| as needed."
|
|
|
|
echo "|"
|
|
|
|
echo "| A perl script may help converting from exim-3.xx config"
|
|
|
|
echo "| files and has been installed in"
|
|
|
|
echo "| ${PREFIX}/share/examples/exim/convert4r4"
|
|
|
|
echo "+---------------"
|
|
|
|
echo
|
2000-08-12 19:57:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Verify proper execution
|
|
|
|
#
|
|
|
|
if [ $# -ne 2 ]; then
|
2004-07-26 06:56:01 -04:00
|
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
|
|
exit 1
|
2000-08-12 19:57:45 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Verify/process the command
|
|
|
|
#
|
|
|
|
case $2 in
|
2004-07-26 06:56:01 -04:00
|
|
|
PRE-INSTALL)
|
|
|
|
do_accts $1
|
|
|
|
;;
|
|
|
|
POST-INSTALL)
|
|
|
|
do_notice "$1"
|
|
|
|
if [ ! -d ${CONFIG_DIR} ]; then
|
|
|
|
do_install_conf "$1"
|
|
|
|
elif [ ! -f ${CONFIG_DIR}/configure ]; then
|
|
|
|
do_install_conf "$1"
|
|
|
|
else
|
|
|
|
do_notice_conf "$1"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2000-08-12 19:57:45 -04:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|