#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 [-q] [-a <authsys>] [-h <host>] [-p <port>] <database>"
    exit 0
fi
while [ -n "$1" ]; do
    case $1 in 
	-q) PSQLOP="$PSQLOP -q";;
	-a) AUTHSYS="-a $2"; shift;;
	-h) PGHOST="-h $2"; shift;;
	-p) PGPORT="-p $2"; shift;;
	 *) DB=$1;;
    esac
    shift
done

createdb $AUTHSYS $PGHOST $PGPORT $DB
psql $PSQLOP $AUTHSYS $PGHOST $PGPORT -f /usr/local/lib/isdk/isdk.psql $DB
