#!/bin/sh
#
# service-pop3ssl-run
# John Simpson <jms1@jms1.net> 2005-11-24
#
# 2008-05-08 jms1 - adding command line dump when service starts
#
###############################################################################
#
# Copyright (C) 2005,2008 John Simpson.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# or visit http://www.gnu.org/licenses/gpl.txt
#
###############################################################################

exec 2>&1
set -a		# causes all shell variables to be exported
		# may be an issue if /bin/sh is not bash

prefix=/usr/lib/courier-imap
exec_prefix=/usr/lib/courier-imap
bindir=${exec_prefix}/bin
libexecdir=/usr/lib/courier-imap/libexec

. ${prefix}/etc/pop3d
. ${prefix}/etc/pop3d-ssl

LIBAUTHMODULES=""

# un-comment this section ONLY if you are using courier-imap 3.x or earlier
#for f in `echo $AUTHMODULES`
#do
#	LIBAUTHMODULES="$LIBAUTHMODULES /usr/lib/courier-imap/libexec/authlib/$f"
#done

# overrides can be done here
#SSLADDRESS=
#SSLPORT=
#POP3DSSLSTART=
#POP3_STARTTLS=
#POP3_TLS_REQUIRED=

CMD="tcpserver -v -c $MAXDAEMONS -R $SSLADDRESS $SSLPORT"
CMD="$CMD $COURIERTLS -server -tcpd"
CMD="$CMD ${exec_prefix}/sbin/pop3login"
CMD="$CMD $LIBAUTHMODULES"
CMD="$CMD ${exec_prefix}/bin/pop3d Maildir"

echo "command line: $CMD"
exec $CMD