-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·57 lines (42 loc) · 1.38 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
. ./config.sh
function buildall() {
# 2. update all.tex
echo "Updating 'all.tex'..."
mv -vf all.tex /tmp/
echo -e "% This is automatically generated with 'build.sh', DO NOT EDIT BY HAND." >> all.tex
cd ./src/
for inputfile in $(find . -iname '[[:digit:]]*.tex' | sed s_'./'_''_ | sort -n); do
echo -e "$inputfile"
echo -e "\input{./src/$inputfile}" >> ../all.tex
done
cd ..
# build
pdflatex main.tex && pdflatex main.tex && pdflatex main.tex
# copy
echo -e "Copying current 'main.pdf' to 'output/$team.pdf' ..."
PDFCompress main.pdf
cp -vf main.pdf output/all.pdf
pdfinfo output/all.pdf | grep 'Pages'
}
function buildteam() {
team=$1
# 2. update all.tex
echo "Updating 'all.tex'..."
mv -vf all.tex /tmp/
echo -e "% This is automatically generated with 'build.sh', DO NOT EDIT BY HAND." >> all.tex
for inputfile in $(find ./src/ -iname '[[:digit:]]*.tex' | shuf | head -n$NB_QUESTIONS); do
echo -e "\input{$inputfile}" >> all.tex
done
# build
pdflatex main.tex && pdflatex main.tex && pdflatex main.tex
# copy
echo -e "Copying current 'main.pdf' to 'output/$team.pdf' ..."
PDFCompress main.pdf
cp -vf main.pdf output/$team.pdf
pdfinfo output/$team.pdf | grep 'Pages'
}
buildall
for team in $(seq 1 $NB_EQUIPES); do
buildteam $team
done