#!/bin/sh
conf_generated_file_path=$1
bindgroup=`cat /etc/group | cut -f 1 -d: | grep named`

if [ -z "$bindgroup" ] ; then
	bindgroup=`cat /etc/group | cut -f 1 -d: | grep bind`
fi

if [ -n "$bindgroup" ]; then
	echo "Changing $conf_generated_file_path/zones permissions to 770 $bindgroup:65534"
        chown -R $bindgroup:65534 $conf_generated_file_path/zones
	chmod -R 0770 $conf_generated_file_path/zones
        chown -R $bindgroup:65534 $conf_generated_file_path/slave_zones
	chmod -R 0770 $conf_generated_file_path/slave_zones
else
	echo "Didn't find named groups, it must be running as root: keeping permissions"
fi
