780b055124
from courier-0.58.0. Changes from version 4.2.1 include: + Teach mkimapdcert and mkpop3dcert to generate certificaties and keys using either GNUTLS or OpenSSL tools. * Remove \Draft flag from messages moved to the trash folder upon expunge from the original folder. * Make clock-skew check more reliable.
84 lines
1.6 KiB
Bash
Executable file
84 lines
1.6 KiB
Bash
Executable file
#!@RCD_SCRIPTS_SHELL@
|
|
#
|
|
# $NetBSD: courierimaps.sh,v 1.18 2008/02/19 18:45:14 jlam Exp $
|
|
#
|
|
# Courier IMAP/SSL services daemon
|
|
#
|
|
# PROVIDE: courierimaps
|
|
# REQUIRE: authdaemond
|
|
# KEYWORD: shutdown
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="courierimaps"
|
|
rcvar=${name}
|
|
command="@PREFIX@/sbin/couriertcpd"
|
|
ctl_command="@PREFIX@/sbin/imapd-ssl"
|
|
pidfile="@COURIER_STATEDIR@/tmp/imapd-ssl.pid"
|
|
required_files="@PKG_SYSCONFDIR@/imapd @PKG_SYSCONFDIR@/imapd-ssl"
|
|
|
|
start_precmd="${name}_prestart"
|
|
start_cmd="${name}_doit start"
|
|
stop_cmd="${name}_doit stop"
|
|
|
|
mkdir_perms()
|
|
{
|
|
dir="$1"; user="$2"; group="$3"; mode="$4"
|
|
@TEST@ -d $dir || @MKDIR@ $dir
|
|
@CHOWN@ $user $dir
|
|
@CHGRP@ $group $dir
|
|
@CHMOD@ $mode $dir
|
|
}
|
|
|
|
courierimaps_prestart()
|
|
{
|
|
mkdir_perms @COURIER_STATEDIR@/tmp \
|
|
@COURIER_USER@ @COURIER_GROUP@ 0770
|
|
}
|
|
|
|
courierimaps_doit()
|
|
{
|
|
action=$1
|
|
case $action in
|
|
start)
|
|
for f in $required_files; do
|
|
if [ ! -r "$f" ]; then
|
|
@ECHO@ 1>&2 "$0: WARNING: $f is not readable"
|
|
return 1
|
|
fi
|
|
done
|
|
|
|
. @PKG_SYSCONFDIR@/imapd
|
|
. @PKG_SYSCONFDIR@/imapd-ssl
|
|
|
|
f="$TLS_CERTFILE"
|
|
if [ -z "$f" ]; then
|
|
@ECHO@ 1>&2 "$0: WARNING: TLS_CERTFILE is empty"
|
|
return 1
|
|
fi
|
|
if [ ! -f "$f" ] && \
|
|
[ "$f" = "@PKG_SYSCONFDIR@/imapd.pem" ]; then
|
|
@ECHO@ "Generating IMAP SSL certificate in $f."
|
|
@PREFIX@/sbin/mkimapdcert >/dev/null 2>&1
|
|
fi
|
|
if [ ! -r "$f" ]; then
|
|
@ECHO@ 1>&2 "$0: WARNING: $f is not readable"
|
|
return 1
|
|
fi
|
|
|
|
case x$IMAPDSSLSTART in
|
|
x[yY]*)
|
|
@ECHO@ "Starting ${name}."
|
|
${ctl_command} $action
|
|
;;
|
|
esac
|
|
;;
|
|
stop)
|
|
@ECHO@ "Stopping ${name}."
|
|
${ctl_command} $action
|
|
;;
|
|
esac
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|