#!/bin/bash -xe
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
ODIR="/var/www/prisirah"
git show master:prisirah.org > "$ODIR"/prisirah.org
org-export-subtree "$ODIR"/prisirah.org "using pre-built" ascii "$ODIR"/README.txt
org-export-subtree "$ODIR"/prisirah.org "using pre-built" html "$ODIR"/README.html
for i in prototypes.jpg micro-raw.jpg lime2-1.jpg lime2-2.jpg lime2-m16.jpg power.jpg calibrate.png friend.png network.png prisirah-image-builder; do
    git show master:$i > "$ODIR"/$i
done
org-export "$ODIR"/prisirah.org html "$ODIR"/index.html
org-export "$ODIR"/prisirah.org latex "$ODIR"/prisirah.tex
pushd "$ODIR"
pdflatex prisirah.tex
pdflatex prisirah.tex
popd
exec git update-server-info
