#! /bin/bash source ./environment.sh echo "Setup PostgreSQL roles" read -s -e -p "Enter password for database owner '${DBOWNER}': " DBPASS echo read -s -e -p "Enter password for user '${PUBUSER}': " JQPASS echo echo "Setup application administrative account" read -s -e -p "Enter password for initial admin account '${ADMIN}': " ADMINPASS echo echo ######################################################################## # Create required roles and then create the database. ${PSQL} -U ${PGADMIN} ${PGOPTS} < ${TMP} if [ -s ${TMP} ]; then echo "SET search_path TO private;" | \ cat - ${TMP} | \ psql -U ${PGADMIN} -d ${DBNAME} rm -f ${TMP} else echo "Error: ${TMP} file doesn't exist or is empty." echo "Did you build pgcrypto contrib module?" echo exit fi ######################################################################## ######################################################################## # Create private tables, functions, and so forth # export PGPASSWORD=${DBPASS} ${PSQL} -U ${DBOWNER} -d ${DBNAME} -h localhost ${PGOPTS}