#!/bin/sh # Remove once ready! # echo "Auditor report generation is work in progress.." # return 1 # 1 generate reports. if test -z ${TALER_DEPLOYMENT}; then echo "Please export env variable TALER_DEPLOYMENT=(test|demo) before running this script" exit 1 fi ACTIVE_COLOR=$(sudo -u ${TALER_DEPLOYMENT} cat /home/${TALER_DEPLOYMENT}/active) if test -z ${ACTIVE_COLOR}; then echo "Could not outline what the active color is" exit 1 fi DATE=$(date +%Y-%m-%d) REPORT_FILE=/home/${ACTIVE_COLOR}/audit_report.${DATE} SUDO_COLOR="sudo -u ${ACTIVE_COLOR}" JINJA_TEMPLATE="auditor-report.tex.j2" REPORTS_DIRECTORY="/home/${TALER_DEPLOYMENT}/reports" ${SUDO_COLOR} sh -c "taler-auditor > ${REPORT_FILE}.txt" # 2 convert them into PDF. # 3 put them into nginx-served directory. ${SUDO_COLOR} sh -c \ "./render_auditor_reports.py \ ${REPORT_FILE}.txt > ${REPORT_FILE}.tex \ < ${JINJA_TEMPLATE}" ${SUDO_COLOR} pdflatex \ --output-directory $REPORTS_DIRECTORY \ "${REPORT_FILE}.tex" ${SUDO_COLOR} rm "${REPORT_FILE}.log" "${REPORT_FILE}.tex" "${REPORT_FILE}.txt" echo "The file ${REPORT_FILE}.pdf" has been correctly generated.