provider/postgres: Allow brew installed postgresql

This commit modifies the GNUmakefile used for starting PostgreSQL for
testing purposes to prefer the version installed via Homebrew, followed
by the version installed via MacPorts. POSTGRES, PSQL and INITDB may be
overriden as Make variables if neither of these package management
systems is in use.
This commit is contained in:
James Nugent 2016-12-27 15:10:20 -06:00
parent f2f495413e
commit 97420f523c
1 changed files with 4 additions and 3 deletions

View File

@ -5,14 +5,15 @@
# may change in the future and is likely not required when doing # may change in the future and is likely not required when doing
# non-delete related operations. But for now it is. # non-delete related operations. But for now it is.
POSTGRES?=/opt/local/lib/postgresql96/bin/postgres POSTGRES?=$(wildcard /usr/local/bin/postgres /opt/local/lib/postgresql96/bin/postgres)
PSQL?=/opt/local/lib/postgresql96/bin/psql PSQL?=$(wildcard /usr/local/bin/psql /opt/local/lib/postgresql96/bin/psql)
INITDB?=$(wildcard /usr/local/bin/initdb /opt/local/lib/postgresql96/bin/initdb)
PGDATA?=$(GOPATH)/src/github.com/hashicorp/terraform/builtin/providers/postgresql/data PGDATA?=$(GOPATH)/src/github.com/hashicorp/terraform/builtin/providers/postgresql/data
initdb:: initdb::
echo "" > pwfile echo "" > pwfile
/opt/local/lib/postgresql96/bin/initdb --no-locale -U postgres -A md5 --pwfile=pwfile -D $(PGDATA) $(INITDB) --no-locale -U postgres -A md5 --pwfile=pwfile -D $(PGDATA)
startdb:: startdb::
2>&1 \ 2>&1 \