This commit is contained in:
Christian Grothoff 2019-09-06 03:08:23 +02:00
parent 58c3e4d98f
commit 07502333a7
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -11,23 +11,46 @@
# #
set -eu set -eu
# Configuation file will be edited, so we create one # Exit, with status code "skip" (no 'real' failure)
# from the template. function exit_skip() {
CONF=generate-auditor-basedb-prod.conf echo $1
cp generate-auditor-basedb-template.conf $CONF exit 77
}
# Where do we write the result?
BASEDB=${1:-"auditor-basedb"}
# Name of the Postgres database we will use for the script. # Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used # Will be dropped, do NOT use anything that might be used
# elsewhere # elsewhere
TARGET_DB=taler-auditor-basedb TARGET_DB=taler-auditor-basedb
# FIXME: try to generate DB from scratch, fall back
# to pre-generated DB if generate-auditor-basedb.sh
# fails with status code 77!
# Configuation file will be edited, so we create one
# from the template.
CONF=generate-auditor-basedb-prod.conf
cp generate-auditor-basedb-template.conf $CONF
echo -n "Testing for taler-bank-manage"
taler-bank-manage -h >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
echo "Testing for taler-wallet-cli"
taler-wallet-cli -h >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
# Clean up # Clean up
DATA_DIR=`taler-config -f -c $CONF -s PATHS -o TALER_HOME` DATA_DIR=`taler-config -f -c $CONF -s PATHS -o TALER_HOME`
rm -rf $DATA_DIR || true rm -rf $DATA_DIR || true
# reset database # reset database
dropdb $TARGET_DB >/dev/null 2>/dev/null || true dropdb $TARGET_DB >/dev/null 2>/dev/null || true
createdb $TARGET_DB createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
# obtain key configuration data # obtain key configuration data
MASTER_PRIV_FILE=`taler-config -f -c $CONF -s EXCHANGE -o MASTER_PRIV_FILE` MASTER_PRIV_FILE=`taler-config -f -c $CONF -s EXCHANGE -o MASTER_PRIV_FILE`
@ -69,6 +92,10 @@ taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
taler-merchant-httpd -c $CONF 2> taler-merchant-httpd.log & taler-merchant-httpd -c $CONF 2> taler-merchant-httpd.log &
taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
# FIXME: also launch taler-auditor-httpd!
# FIXME: interactive test here instead of waiting!
sleep 10 sleep 10
# run wallet CLI # run wallet CLI
@ -80,12 +107,12 @@ kill `jobs -p`
# Dump database # Dump database
echo "Dumping database" echo "Dumping database"
pg_dump -O $TARGET_DB | sed -e '/AS integer/d' > auditor-basedb.sql pg_dump -O $TARGET_DB | sed -e '/AS integer/d' > ${BASEDB}.sql
echo $MASTER_PUB > auditor-basedb.mpub echo $MASTER_PUB > ${BASEDB}.mpub
WIRE_FEE_DIR=`taler-config -c $CONF -f -s exchangedb -o WIREFEE_BASE_DIR` WIRE_FEE_DIR=`taler-config -c $CONF -f -s exchangedb -o WIREFEE_BASE_DIR`
cp $WIRE_FEE_DIR/x-taler-bank.fee auditor-basedb.fees cp $WIRE_FEE_DIR/x-taler-bank.fee ${BASEDB}.fees
# clean up # clean up
echo "Final clean up" echo "Final clean up"