| #!/bin/sh |
| |
| # MathJax is used by doxygen to display formulas in HTML |
| MATHJAX_INSTALLATION="@MATHJAX_INSTALLATION@" |
| MATHJAX_LAST_UPDATE="${MATHJAX_INSTALLATION}/.last_update" |
| MATHJAX_UPDATE_INTERVAL=7 |
| |
| # If the modification date of ${MATHJAX_LAST_UPDATE} is less than |
| # ${MATHJAX_UPDATE_INTERVAL} days, we will update MathJax. |
| MATHJAX_NEEDS_UPDATE=$( \ |
| if [[ -f ${MATHJAX_LAST_UPDATE} && \ |
| $(( $(date "+%s") \ |
| - $(perl -e 'printf "%u", (stat shift)[9]' ${MATHJAX_LAST_UPDATE}) )) \ |
| -lt $(( ${MATHJAX_UPDATE_INTERVAL} * 24 * 60 * 60 )) ]]; \ |
| then \ |
| echo 0; \ |
| else \ |
| echo 1; \ |
| fi) |
| |
| # Update the mathjax installation, which is used by doxygen |
| # See http://www.mathjax.org/resources/docs/?installation.html |
| if [ ${MATHJAX_NEEDS_UPDATE} -ne 0 ]; then |
| echo "MathJax needs update. Will sync with repository..." |
| if [ -d "${MATHJAX_INSTALLATION}" ]; then |
| echo "Updating mathjax git repository..." |
| cd "${MATHJAX_INSTALLATION}" |
| git pull origin |
| else |
| echo "Cloning mathjax git repositry..." |
| git clone git://github.com/mathjax/MathJax.git "${MATHJAX_INSTALLATION}" |
| cd "${MATHJAX_INSTALLATION}" |
| fi |
| if [ -f fonts.zip ]; then |
| if [ -d fonts ]; then |
| echo "Removing old mathjax fonts directory..." |
| rm -rf fonts |
| fi |
| echo "Unpacking mathjax fonts..." |
| unzip fonts.zip |
| fi |
| echo "Updating timestamp of last sync with mathjax repository..." |
| touch ".last_update" |
| echo "Mathjax successfully updated." |
| else |
| echo "Mathjax does not need to be updated." |
| fi |