#! /bin/sh

# Script that is executed whenever a new company is deleted from
# the external user source, such as an Active Directory tree or
# /etc/passwd.

# This script executes all scripts in @USERSCRIPTDIR@/deletecompany.d
# using find.  The environment variable KOPANO_COMPANY is set, but
# beware that this string can contain any characters, so take heed to
# correct quoting.

KOPANO_COMPANY_SCRIPTS=/ignore/
PATH=/bin:/usr/local/bin:/usr/bin
export PATH
if [ -z "${KOPANO_COMPANY}" -a -z "${KOPANO_COMPANYID}" ] ; then
    exec >&2
    echo "KOPANO_COMPANY and KOPANO_COMPANYID is not set."
    exit 1
fi
exec "/usr/local/libexec/kopano/kscriptrun" /usr/local/lib/kopano/userscripts/deletecompany.d /etc/kopano/userscripts/deletecompany.d
