summaryrefslogtreecommitdiff
path: root/src/auditor/test-auditor.sh
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-19 14:04:53 +0200
committerFlorian Dold <florian@dold.me>2022-09-19 14:04:53 +0200
commit1aed3c1fd2a9998800b0ab35e7a7bd3b4da1cf54 (patch)
tree3316bdff5e5e4028c32f759a7f039c9cde3d9d78 /src/auditor/test-auditor.sh
parentda69fd9c72c5060be1ee6375da5901b7cb9bf257 (diff)
downloadexchange-1aed3c1fd2a9998800b0ab35e7a7bd3b4da1cf54.tar.gz
exchange-1aed3c1fd2a9998800b0ab35e7a7bd3b4da1cf54.tar.bz2
exchange-1aed3c1fd2a9998800b0ab35e7a7bd3b4da1cf54.zip
auditor tests: make initdb invocation more portable
Diffstat (limited to 'src/auditor/test-auditor.sh')
-rwxr-xr-xsrc/auditor/test-auditor.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index d1e24c199..ec5a4585e 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -2041,10 +2041,16 @@ MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
echo -n "Testing for Postgres"
-HAVE_INITDB=`find /usr -name "initdb" 2> /dev/null | grep postgres` || exit_skip " MISSING"
-echo " FOUND at" `dirname $HAVE_INITDB`
+# Available directly in path?
+INITDB_BIN=$(command -v initdb)
+if [[ ! -z $INITDB_BIN ]]; then
+ echo " FOUND (in path) at" $INITDB_BIN
+else
+ HAVE_INITDB=`find /usr -name "initdb" 2> /dev/null | grep postgres` || exit_skip " MISSING"
+ echo " FOUND at" `dirname $HAVE_INITDB`
+ INITDB_BIN=`echo $HAVE_INITDB | grep bin/initdb | grep postgres | sort -n | tail -n1`
+fi
echo -n "Setting up Postgres DB"
-INITDB_BIN=`echo $HAVE_INITDB | grep bin/initdb | grep postgres | sort -n | tail -n1`
POSTGRES_PATH=`dirname $INITDB_BIN`
TMPDIR=`mktemp -d /tmp/taler-test-postgresXXXXXX`
$INITDB_BIN --no-sync --auth=trust -D ${TMPDIR} > postgres-dbinit.log 2> postgres-dbinit.err