#!/usr/bin/env bash

if [ ! -d /data/domains ]; then
    echo -e "\t\t\033[1;33m* creating /data/domains directory\033[0m"
    mkdir -p /data/domains
fi

# removed stat --format '%U' ... and stat --format '%G' ... to get rid of statx bug
user="$(/bin/core-username "/data/domains")"
group="$(/bin/core-groupname "/data/domains")"
if [ "mail" != "${user}" ] || [ "mail" != "${group}" ] ; then
    chown mail:mail -R /data/domains
fi