#!/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 (C) 2002-2008 Open Source Development Labs, Inc.
#               2002-2021 Mark Wong
#

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

# Create database
echo "Creating database..."
createdb ${PORTOPT} ${DBT2DBNAME} || exit 1

exit 0
