#!/bin/sh
# Configuration System for Qmail
# $Id: qmail-config-system,v 1.4 2004/11/28 13:42:50 glen Exp $
# This is a configuration system to make using and controlling the interesting parts of the qmail behavior simple
# The only variable that needs to be set before running this is $SERVICE

QMAIL_CONTROLDIR=${QMAIL_CONTROLDIR:-/etc/qmail/control}

# now run
# grab the common configuration
[ -s ${QMAIL_CONTROLDIR}/conf-common ] && . ${QMAIL_CONTROLDIR}/conf-common

# grab the per-service configuration
[ -s ${QMAIL_CONTROLDIR}/conf-${SERVICE}d ] && . ${QMAIL_CONTROLDIR}/conf-${SERVICE}d
# special case for qmail-send
[ "${SERVICE}" = "send" -a -s ${QMAIL_CONTROLDIR}/conf-send ] && . ${QMAIL_CONTROLDIR}/conf-send

# you may want to disable this at some point, so I give you the choice here
if [ -s /var/qmail/bin/config-sanity-check -a -z "${QMAIL_DISABLE_SANITY_CHECK}" ]; then
    . /var/qmail/bin/config-sanity-check
else
    echo "Failed to find sanity checker!"
    sleep 30s
    exit 1
fi
