#!/bin/bash # Logic that creates auditor reports, respecting # the config file that lives under ${HOME}/.config/taler.conf. # The results will be found under ${HOME}/reports/ set -eu echo "Running taler-deployment bootstrap" source ${HOME}/activate taler-deployment bootstrap echo "Running taler-deployment build" source ${HOME}/activate taler-deployment build DATE=$(date +%Y-%m-%d) REPORTS_DIRECTORY=$(taler-config -s auditor -o reports -f) mkdir -p "${REPORTS_DIRECTORY}" REPORT_FILE="${REPORTS_DIRECTORY}/${DATE}-report.pdf" if test -a "${REPORT_FILE}" then echo "Today's report already compiled!" exit 0 fi CONFIG_FILE="${TALER_HOME}/.config/taler.conf" # Generate today's report. echo "Running taler-auditor" if ! taler-auditor -c ${CONFIG_FILE} | tee build-log.txt; then echo "taler-auditor failed" clean_files exit 1 fi REPORT=`tail -n1 build-log.txt | grep "Result is in" | awk '{print $4}'` if ! test -f "${REPORT}"; then echo Could not produce the report exit 1 fi chmod 444 "${REPORT}" mv "${REPORT}" "${REPORT_FILE}" echo "Report moved to ${REPORTS_DIRECTORY}." rm -r `dirname $REPORT` exit 0