1998-12-16 13:30:46 -05:00
|
|
|
#!/bin/sh
|
2011-04-27 20:22:23 -04:00
|
|
|
# $OpenBSD: postfix-install,v 1.5 2011/04/28 00:22:23 sthen Exp $
|
1998-12-16 13:30:46 -05:00
|
|
|
#
|
2007-05-31 06:19:00 -04:00
|
|
|
# Post-installation setup of postfix
|
1998-12-16 13:30:46 -05:00
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
2003-05-01 11:46:38 -04:00
|
|
|
CONFIG_DIR=${SYSCONFDIR}/postfix
|
2003-01-06 06:37:24 -05:00
|
|
|
SAMPLE_CONFIG_DIR=${PREFIX}/share/examples/postfix
|
1999-06-13 12:15:57 -04:00
|
|
|
SPOOL_DIR=/var/spool/postfix
|
2008-02-01 11:53:58 -05:00
|
|
|
DATA_DIR=/var/postfix
|
1998-12-16 13:30:46 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
# Function: set up the postfix spool dir / chroot area
|
|
|
|
#
|
|
|
|
do_spooldir()
|
|
|
|
{
|
1999-10-07 16:58:03 -04:00
|
|
|
echo "-> Creating Postfix spool directory and chroot area under $SPOOL_DIR"
|
2000-08-15 13:01:22 -04:00
|
|
|
[ -d $SPOOL_DIR ] || install -d -o root -g wheel -m 755 $SPOOL_DIR
|
|
|
|
[ -d $SPOOL_DIR/etc ] || install -d -o root -g wheel -m 755 $SPOOL_DIR/etc
|
2002-04-19 17:11:29 -04:00
|
|
|
[ -d $SPOOL_DIR/dev ] || install -d -o root -g wheel -m 755 $SPOOL_DIR/dev
|
2011-04-27 20:22:23 -04:00
|
|
|
for file in hosts localtime resolv.conf services ; do
|
2002-12-21 11:24:48 -05:00
|
|
|
install -o root -g wheel -m 644 /etc/$file $SPOOL_DIR/etc
|
1999-06-13 12:15:57 -04:00
|
|
|
done
|
2008-02-01 11:53:58 -05:00
|
|
|
|
|
|
|
echo "-> Creating Postfix data directory under $DATA_DIR"
|
|
|
|
[ -d $DATA_DIR ] || install -d -o _postfix -g wheel -m 700 $DATA_DIR
|
1999-06-13 12:15:57 -04:00
|
|
|
}
|
1998-12-16 13:30:46 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
# Function: replace sendmail binaries with postfix
|
|
|
|
#
|
1999-10-07 16:58:03 -04:00
|
|
|
do_mailwrapper()
|
1999-06-13 12:15:57 -04:00
|
|
|
{
|
1999-10-07 16:58:03 -04:00
|
|
|
echo "-> Creating /etc/mailer.conf.postfix"
|
2007-05-31 06:19:00 -04:00
|
|
|
cat <<MAILER | sed "s@y0y0y0@$PREFIX@g" >/etc/mailer.conf.postfix
|
1999-09-26 16:35:11 -04:00
|
|
|
sendmail y0y0y0/sbin/sendmail
|
|
|
|
send-mail y0y0y0/sbin/sendmail
|
|
|
|
mailq y0y0y0/sbin/sendmail
|
|
|
|
newaliases y0y0y0/sbin/sendmail
|
|
|
|
MAILER
|
1999-10-07 16:58:03 -04:00
|
|
|
chown root:wheel /etc/mailer.conf.postfix
|
|
|
|
chmod 644 /etc/mailer.conf.postfix
|
1999-06-13 12:15:57 -04:00
|
|
|
}
|
1999-01-11 22:22:46 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
# Function: install the postfix configuration files from the samples
|
|
|
|
#
|
|
|
|
do_configs()
|
|
|
|
{
|
2008-02-01 11:53:58 -05:00
|
|
|
POSTFIX="${PREFIX}/sbin/postfix"
|
2003-01-06 06:37:24 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
if [ -d $CONFIG_DIR ]; then
|
2003-01-06 06:37:24 -05:00
|
|
|
echo ""
|
2008-02-01 11:53:58 -05:00
|
|
|
$POSTFIX upgrade-configuration
|
1999-10-07 16:58:03 -04:00
|
|
|
echo ""
|
2003-01-06 06:37:24 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
echo "+---------------"
|
2007-05-31 06:19:00 -04:00
|
|
|
echo "| The existing configuration files in $CONFIG_DIR have been preserved."
|
2003-01-06 06:37:24 -05:00
|
|
|
echo "| You may want to compare them to the current sample files,"
|
|
|
|
echo "| $SAMPLE_CONFIG_DIR, and update your configuration as needed."
|
1999-10-07 16:58:03 -04:00
|
|
|
echo "+---------------"
|
|
|
|
echo ""
|
1999-06-13 12:15:57 -04:00
|
|
|
else
|
2000-08-15 13:01:22 -04:00
|
|
|
install -d -o root -g wheel -m 755 $CONFIG_DIR
|
|
|
|
install -o root -g wheel -m 644 $SAMPLE_CONFIG_DIR/* $CONFIG_DIR
|
1998-12-16 13:30:46 -05:00
|
|
|
|
1999-06-13 12:15:57 -04:00
|
|
|
echo "+---------------"
|
2007-05-31 06:19:00 -04:00
|
|
|
echo "| Configuration files have been installed in $CONFIG_DIR."
|
2003-01-06 06:37:24 -05:00
|
|
|
echo "| Please update these files to meet your needs."
|
1999-06-13 12:15:57 -04:00
|
|
|
echo "+---------------"
|
|
|
|
fi
|
1999-10-07 16:58:03 -04:00
|
|
|
|
2008-02-01 11:53:58 -05:00
|
|
|
$POSTFIX set-permissions
|
|
|
|
$POSTFIX check
|
1999-10-07 16:58:03 -04:00
|
|
|
}
|
|
|
|
|
2009-03-15 15:38:05 -04:00
|
|
|
if [ "$1" = "install" ]; then
|
|
|
|
do_mailwrapper
|
|
|
|
do_spooldir
|
|
|
|
fi
|
2007-05-31 06:19:00 -04:00
|
|
|
do_configs
|