#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:          courier-mlm
# Required-Start:    courier-authdaemon $remote_fs $syslog
# Required-Stop:     courier-authdaemon $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Courier WebMLM server
### END INIT INFO

# Author: Ondřej Surý <ondrej@debian.org>,
#         Markus Wanner <markus@bluegap.ch>

CONFIGFILE=/etc/courier/webmlmrc
DAEMON=/usr/bin/webmlmd
DESC="Courier WebMLM daemon"
DAEMON_ARGS="$CONFIGFILE"
PIDFILE=$(/bin/sh -c ". $CONFIGFILE; echo \"\$PIDFILE\";")
LISTS=$(/bin/sh -c ". $CONFIGFILE; echo \"\$LISTS\";")

# Check whether webmlm can start.
if [ -z "$LISTS" ]; then
    log_begin_msg "courier-mlm: no LISTS configured, not starting or reloading..."
    log_end_msg 1
    exit 1
else
    DO_START=yes
fi

. /usr/lib/courier/init-d-script-courier
