#! /bin/sh

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

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

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