2021-01-10 13:15:23 +01:00
|
|
|
#!/bin/bash
|
2020-03-21 16:09:22 +01:00
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2021-01-10 13:15:23 +01:00
|
|
|
function usage {
|
|
|
|
cat - <<EOF
|
|
|
|
taler-auditor
|
|
|
|
Audit Taler exchange database for consistency.
|
|
|
|
Arguments mandatory for long options are also mandatory for short options.
|
|
|
|
-c, --config=FILENAME use configuration file FILENAME
|
|
|
|
-h, --help print this help
|
|
|
|
-i, --internal perform checks only applicable for
|
|
|
|
exchange-internal audits
|
|
|
|
-L, --log=LOGLEVEL configure logging to use LOGLEVEL
|
|
|
|
-l, --logfile=FILENAME configure logging to write logs to FILENAME
|
|
|
|
-m, --exchange-key=KEY public key of the exchange (Crockford base32
|
|
|
|
encoded)
|
|
|
|
-T, --timetravel=[+/-]MICROSECONDS
|
|
|
|
modify system time by given offset (for
|
|
|
|
debugging/testing only)
|
|
|
|
-v, --version print the version number
|
|
|
|
Report bugs to taler@gnu.org.
|
|
|
|
Home page: http://www.gnu.org/s/taler/
|
|
|
|
General help using GNU software: http://www.gnu.org/gethelp/
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2021-01-11 10:52:33 +01:00
|
|
|
|
|
|
|
function optcheck {
|
|
|
|
|
2021-01-10 13:15:23 +01:00
|
|
|
TEMP=`getopt -o c:hiL:l:m:T:v --long config:,help,internal,log:,logfile:exchange-key:,timetravel:,version -n 'taler-auditor' -- "$@"`
|
|
|
|
|
|
|
|
if [ $? != 0 ] ;
|
|
|
|
then
|
|
|
|
exit 1 ;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Note the quotes around `$TEMP': they are essential!
|
|
|
|
eval set -- "$TEMP"
|
|
|
|
|
|
|
|
VERBOSE=false
|
|
|
|
DEBUG=false
|
|
|
|
MEMORY=
|
|
|
|
DEBUGFILE=
|
|
|
|
JAVA_MISC_OPT=
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-c | --config ) shift 2 ;;
|
|
|
|
-h | --help )
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-i | --internal ) shift ;;
|
|
|
|
-L | --log ) shift 2;;
|
|
|
|
-l | --logfile ) shift ;;
|
|
|
|
-m | --exchange-key ) shift 2 ;;
|
|
|
|
-t | --timetravel ) shift 2 ;;
|
|
|
|
-m | --memory ) MEMORY="$2"; shift 2 ;;
|
|
|
|
-v | --version )
|
|
|
|
taler-helper-auditor-deposits -v | sed -e 's/taler-helper-auditor-deposits/taler-auditor/'
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-- )
|
|
|
|
shift;
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-01-11 10:52:33 +01:00
|
|
|
}
|
|
|
|
# End of function 'optcheck'
|
|
|
|
|
|
|
|
|
|
|
|
optcheck "$@"
|
|
|
|
|
2021-01-10 13:15:23 +01:00
|
|
|
|
2020-03-21 16:09:22 +01:00
|
|
|
DIR=`mktemp -d reportXXXXXX`
|
|
|
|
for n in aggregation coins deposits reserves wire
|
|
|
|
do
|
|
|
|
taler-helper-auditor-$n "$@" > ${DIR}/$n.json
|
|
|
|
done
|
|
|
|
|
|
|
|
taler-helper-auditor-render.py \
|
|
|
|
${DIR}/aggregation.json \
|
|
|
|
${DIR}/coins.json \
|
|
|
|
${DIR}/deposits.json \
|
|
|
|
${DIR}/reserves.json \
|
2021-07-26 16:16:52 +02:00
|
|
|
${DIR}/wire.json < %datadir%/taler/exchange/auditor-report.tex.j2 > ${DIR}/auditor-report.tex
|
2020-03-21 16:09:22 +01:00
|
|
|
cd ${DIR}
|
2020-03-31 14:41:55 +02:00
|
|
|
pdflatex auditor-report.tex < /dev/null &> /dev/null || true
|
|
|
|
pdflatex auditor-report.tex < /dev/null &> /dev/null || true
|
|
|
|
pdflatex auditor-report.tex < /dev/null || echo "pdflatex failed"
|
2020-03-21 16:09:22 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Result is in ${DIR}/auditor-report.pdf"
|