#!/bin/sh

COUCH_USER=couchdb
COUCH_GROUP=couchdb

CHOWN=/usr/sbin/chown
MKDIR="/bin/mkdir -p"

COUCH_DBDIR=/var/db/couchdb
COUCH_LOGDIR=/var/log/couchdb
COUCH_RUNDIR=/var/run/couchdb

if [ "$2" = "POST-INSTALL" ]; then
	${MKDIR} ${COUCH_DBDIR} ${COUCH_LOGDIR} ${COUCH_RUNDIR}
	${CHOWN} ${COUCH_USER}:${COUCH_GROUP} ${COUCH_DBDIR}
	${CHOWN} ${COUCH_USER}:${COUCH_GROUP} ${COUCH_LOGDIR}
	${CHOWN} ${COUCH_USER}:${COUCH_GROUP} ${COUCH_RUNDIR}
fi

exit 0
