Skip to content

Instantly share code, notes, and snippets.

@simonswine
Created August 6, 2013 05:59
Show Gist options
  • Save simonswine/6162380 to your computer and use it in GitHub Desktop.
Save simonswine/6162380 to your computer and use it in GitHub Desktop.
Build script for building latex docs via jenkins in a cow chroot. (Pretty sure this isn't very secure, as anyone who has access to the git/svn/vcs can break out of chroot as root)
#!/bin/bash
# Clean up
rm -f *.pdf
cd source
# Entferne altes nicht gitiges
git clean -fx
cd $WORKSPACE
# Latex Base Builder erstellen
COWBUILDER_BASE="/var/cache/pbuilder/base-wheezy-latex-amd64.cow"
COWBUILDER_EXTRA_PACKAGES="texlive-xetex,texlive-latex-recommended,texlive-latex-extra,texlive-lang-german,texlive-fonts-recommended,latex-beamer,latex-xcolor,pgf,texlive-pstricks,texlive-generic-recommended,biblatex"
# Erstelle chroot if not exists
if [ ! -d "$DIRECTORY" ]; then
sudo cowbuilder --create --basepath $COWBUILDER_BASE --distribution wheezy --debootstrapopts --arch --debootstrapopts amd64 --debootstrapopts --include --debootstrapopts $COWBUILDER_EXTRA_PACKAGES
fi
# Wechsle zu den Sourcen
cd source
# Baue pdf
sudo cowbuilder --execute --basepath $COWBUILDER_BASE --bindmounts $WORKSPACE build.sh
# Verschiebe pdf
cd $WORKSPACE
for i in source/PDF/*.pdf
do basename=$(basename $i)
mv $i ./${basename%%????}_${BUILD_NUMBER}.pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment