98 lines
2.5 KiB
Plaintext
98 lines
2.5 KiB
Plaintext
#!/bin/sh
|
|
# $OpenBSD: INSTALL,v 1.9 2003/07/16 10:32:18 kevlo Exp $
|
|
#
|
|
# Pre/post-installation setup of openwebmail
|
|
|
|
# exit on errors, use a sane path and install prefix
|
|
#
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
|
PREFIX=${PKG_PREFIX:-/var/www}
|
|
CONFIG_DIR=${CONFDIR}/openwebmail
|
|
CONFIG_FILE=$CONFIG_DIR/openwebmail.conf
|
|
CGI_DIR=${PREFIX}/cgi-bin/openwebmail
|
|
SAMPLE_CONFIG_FILE=$CONFIG_FILE.default
|
|
SCRIPTFILES="openwebmail-abook.pl openwebmail-advsearch.pl openwebmail-cal.pl \
|
|
openwebmail-folder.pl openwebmail-main.pl openwebmail-prefs.pl \
|
|
openwebmail-read.pl openwebmail-send.pl openwebmail-spell.pl \
|
|
openwebmail-tool.pl openwebmail-vdomain.pl openwebmail-viewatt.pl \
|
|
openwebmail-webdisk.pl openwebmail.pl"
|
|
|
|
# Function: tell the user what they need to do to use the port just installed
|
|
#
|
|
do_notice()
|
|
{
|
|
echo
|
|
echo "+---------------"
|
|
echo "| The existing $1 configuration file,"
|
|
echo "| $CONFIG_FILE,"
|
|
echo "| has NOT been changed. You may want to"
|
|
echo "| compare it to the current sample file"
|
|
echo "| $SAMPLE_CONFIG_FILE"
|
|
echo "| and update your configuration as needed."
|
|
echo "+---------------"
|
|
echo
|
|
}
|
|
|
|
# Function: install configuration files
|
|
#
|
|
do_install()
|
|
{
|
|
for file in $SCRIPTFILES
|
|
do
|
|
chmod 4555 $CGI_DIR/$file
|
|
done
|
|
chmod 770 $CONFIG_DIR/sessions
|
|
chmod 770 $CONFIG_DIR/users
|
|
install -o root -g wheel -m 644 $SAMPLE_CONFIG_FILE $CONFIG_FILE
|
|
echo "/var/www/cgi-bin/openwebmail/" | cat > $CONFIG_DIR/openwebmail_path.conf
|
|
perl $CGI_DIR/openwebmail-tool.pl --init --no
|
|
echo
|
|
echo "+---------------"
|
|
echo "| The $1 configuration file,"
|
|
echo "| $CONFIG_FILE,"
|
|
echo "| has been installed. Please view this file and"
|
|
echo "| change the configuration to meet your needs."
|
|
echo "+---------------"
|
|
echo
|
|
}
|
|
|
|
do_warning()
|
|
{
|
|
echo "+---------------"
|
|
echo "| WARNING!"
|
|
echo "|"
|
|
echo "| This port has changed its user from 'mail' to 'wheel'. If you"
|
|
echo "| installed this port before, ensure all permissions are set"
|
|
echo "| correctly and then \"groupdel mail\"."
|
|
echo "+---------------"
|
|
}
|
|
|
|
# Verify proper execution
|
|
#
|
|
if [ $# -ne 2 ]; then
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Verify/process the command
|
|
#
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
: nothing to pre-install for this port
|
|
;;
|
|
POST-INSTALL)
|
|
if [ -f ${CONFIG_FILE} ]; then
|
|
do_notice "$1"
|
|
else
|
|
do_install "$1"
|
|
fi
|
|
do_warning
|
|
;;
|
|
*)
|
|
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|