#!/bin/bash
# language either EN for english or all for everything else
L='EN'
# update the system
sudo apt-get update
# install the required packages
sudo apt-get install -y texlive-latex-base texlive-binaries texlive-xetex texlive-generic-extra texlive-generic-recommended texlive-latex-extra texlive-latex-recommended texlive-science latex-xcolor lmodern fonts-lmodern fonts-liberation fonts-droid-fallback texlive-fonts-recommended texlive-fonts-extra
# clone the repository
git clone --recursive https://github.com/DennisYurichev/RE-for-beginners.git
# change to the directory with the sources
cd RE-for-beginners
# create a temporary directory
mkdir ./temp
# compile to the temp directory
make $L > "$PWD/temp/null"
# this isn't really needed
# rm -rf ./temp
# copy the pdf out the directory
cp "RE4B-$L.pdf" ../
# remove the sources
cd ../ && rm -rf ./RE-for-beginners