#!/bin/bash
#
#	fix permissinons on TYPEMILL dir
#
# ::do_not_edit::
# ::maintainer::
#
# uses kusa db definitions:
#
#	apache.user
#	apache.group
#
# run   "kusa-reconf srv-typemill"   again if you change one of them
#
set -e -u

user="::apache.user::"
group="::apache.group::"

[ "X${PRJ:-}" = "X" ] && {
	PRJ=$(dirname "$0")
	cd "$PRJ/.."
	export PRJ=$(pwd)
}

instdir=$(cat $PRJ/etc/instdir)
cd "$instdir"

echo -n "  TYPEMILL: fixing perms on $(pwd) ... "

echo -n "files ... "
chown -R ${user}:${group} .
chmod -R g+rw .

echo -n "dirs ... "
find . -type d -exec chmod 2770 {} \;

echo "ok"
exit 0
