#!/bin/bash
set -e
-BRANCH=cs
+LANGUAGES="cs en"
VERSIONS="bc mgr phd rig"
-TMPL=sablona
-SPEC=vzor
function template ()
{
- local ver=$1
-
- echo "### Generating $TMPL-$ver"
- git archive --prefix=out/$TMPL-$ver/ $BRANCH | tar xf -
+ local TMPL=thesis-$LANGU
+ echo "### Generating $TMPL"
+ git archive --prefix=out/$TMPL/ $LANGU | tar xf -
(
- cd out/$TMPL-$ver
+ cd out/$TMPL/
(
date +'%Y-%m-%d'
echo -n 'Git commit: '
git rev-parse $BRANCH
) >VERSION
)
+
+ echo "### Zipping $TMPL"
+ (
+ cd out
+ zip -r $TMPL.zip $TMPL
+ )
}
function specimen ()
{
local ver=$1
- echo "### Generating $SPEC-$ver"
- git archive --prefix=out/$SPEC-$ver/ $BRANCH-specimen | tar xf -
+ echo "### Generating specimen-$ver"
+ git archive --prefix=out/specimen-$ver/ $LANGU-specimen | tar xf -
(
- cd out/$SPEC-$ver
- sed -i "/\\def\\ThesisType/s/{.*}/{$ver}/" -i metadata.tex
+ cd out/specimen-$ver
+ sed -i '/\\def\\ThesisType/s/{.*}/{'$ver'}/' metadata.tex
if ! make >make.log 2>&1 thesis.pdf ; then
echo >2 "make failed, see $SPEC-$ver/make.log for details"
exit 1
fi
)
- cp out/$SPEC-$ver/thesis.pdf out/$TMPL-$ver/$SPEC.pdf
+ cp out/specimen-$ver/thesis.pdf out/thesis-$LANGU-$ver.pdf
}
-function archive ()
+function language ()
{
- local ver=$1
+ local LANGU=$1
- echo "### Zipping $TMPL-$ver"
- zip -r out/$TMPL-$ver.zip out/$TMPL-$ver
+ template
+ for ver in $VERSIONS ; do
+ specimen $ver
+ done
}
rm -rf out
mkdir out
-for ver in $VERSIONS ; do
- template $ver
- specimen $ver
- archive $ver
-done
+language cs
+language en