summaryrefslogtreecommitdiff
path: root/buildbot/with-postgres.sh
blob: a4552d9b2201e17273e9dc9368b85c95ed05273a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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
$PG_DIR/createdb anastasischeck

# Run the commands
"$@"

# Stop postgres
$PG_DIR/pg_ctl -D $TMP_DB_DIR/ stop
rm -rf $TMP_DB_DIR