#!/bin/bash # This file is in the public domain. # Runs the commands given at "$@" with a locally started postgres instance PG_VER=12 PG_DIR=/usr/lib/postgresql/$PG_VER/bin # setup little postgres DB for us ... TMP_DB_DIR=`mktemp -d ~/tmpXXXXXX` $PG_DIR/initdb -D $TMP_DB_DIR/ -A trust export PGPORT=5432 export PGHOST=localhost $PG_DIR/pg_ctl -D $TMP_DB_DIR/ -o "-c unix_socket_directories=$HOME" -l logfile start $PG_DIR/createdb talercheck $PG_DIR/createdb synccheck # Run the commands "$@" # Stop postgres $PG_DIR/pg_ctl -D $TMP_DB_DIR/ stop rm -rf $TMP_DB_DIR