#!/bin/sh

DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7

BINDIR=${DATABASEHOME}/bin


PATH=$PATH:$BINDIR
export PATH

echo "Enter the postgres administrator's database password to create a new user for rt"

if [ "fnord$PORT" != "fnord" ]; then
	PORT="-p $PORT"
fi;

if [ "fnord$HOSTNAME" != "fnord" ]; then
	HOSTNAME="-h $HOSTNAME"
fi;

psql $HOSTNAME $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN

