#!/bin/sh

if [ x"$2" != x"POST-INSTALL" ]; then
    exit 0
fi

USERS_HOME="/var/spool/ejabberd"

install -d -m 750 -o ejabberd -g ejabberd ${USERS_HOME} /var/log/ejabberd /var/run/ejabberdctl

chown -R ejabberd:ejabberd  /usr/local/etc/ejabberd
chown -R ejabberd:ejabberd  /usr/local/lib/erlang/lib/ejabberd-25.04

find /usr/local/lib/erlang/lib/ejabberd-25.04 -type f -print0 | xargs -0 chmod 444
find /usr/local/lib/erlang/lib/ejabberd-25.04 -type f -print0 | xargs -0 chown root:wheel


chmod +x /usr/local/lib/erlang/lib/ejabberd-25.04/lib/eimp-1.0.24/priv/bin/eimp

exit 0
