openbsd-ports/mail/postfix/snapshot/files/postfix-install

79 lines
2.2 KiB
Plaintext
Raw Normal View History

1998-12-16 13:30:46 -05:00
#!/bin/sh
# $OpenBSD: postfix-install,v 1.5 2011/04/28 00:22:23 sthen Exp $
1998-12-16 13:30:46 -05:00
#
# Post-installation setup of postfix
1998-12-16 13:30:46 -05:00
PATH=/bin:/usr/bin:/sbin:/usr/sbin
CONFIG_DIR=${SYSCONFDIR}/postfix
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()
{
echo "-> Creating Postfix spool directory and chroot area under $SPOOL_DIR"
[ -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
for file in hosts localtime resolv.conf services ; do
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
#
do_mailwrapper()
1999-06-13 12:15:57 -04:00
{
echo "-> Creating /etc/mailer.conf.postfix"
cat <<MAILER | sed "s@y0y0y0@$PREFIX@g" >/etc/mailer.conf.postfix
sendmail y0y0y0/sbin/sendmail
send-mail y0y0y0/sbin/sendmail
mailq y0y0y0/sbin/sendmail
newaliases y0y0y0/sbin/sendmail
MAILER
chown root:wheel /etc/mailer.conf.postfix
chmod 644 /etc/mailer.conf.postfix
1999-06-13 12:15:57 -04: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"
1999-06-13 12:15:57 -04:00
if [ -d $CONFIG_DIR ]; then
echo ""
2008-02-01 11:53:58 -05:00
$POSTFIX upgrade-configuration
echo ""
1999-06-13 12:15:57 -04:00
echo "+---------------"
echo "| The existing configuration files in $CONFIG_DIR have been preserved."
echo "| You may want to compare them to the current sample files,"
echo "| $SAMPLE_CONFIG_DIR, and update your configuration as needed."
echo "+---------------"
echo ""
1999-06-13 12:15:57 -04:00
else
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 "+---------------"
echo "| Configuration files have been installed in $CONFIG_DIR."
echo "| Please update these files to meet your needs."
1999-06-13 12:15:57 -04:00
echo "+---------------"
fi
2008-02-01 11:53:58 -05:00
$POSTFIX set-permissions
$POSTFIX check
}
if [ "$1" = "install" ]; then
do_mailwrapper
do_spooldir
fi
do_configs