#!/bin/sh
#
# This file is released under the terms of the Artistic License.
# Please see the file LICENSE, included in this package, for details.
#
# Copyright The DBT-2 Authors
#

# Double check we have a value for DBT2PGDATA
if [ -z ${DBT2PGDATA} ]; then
	echo "DBT2PGDATA not defined."
	exit 1
fi

if [ -z ${DBT2DBNAME} ]; then
	echo "DBT2DBNAME not defined."
	exit 1
fi

while getopts "l:" OPT; do
	case ${OPT} in
	l)
		PORT=${OPTARG}
		;;
	esac
done

if [ ! "x${PORT}" = "x" ]; then
	PORTOPT="-p ${PORT}"
fi

dropdb ${PORTOPT} ${DBT2DBNAME} || exit 1

exit 0
