-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.sh
executable file
·75 lines (60 loc) · 2.47 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -e
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR
# get the path to this script
REPO_ROOT=`dirname "$0"`
REPO_ROOT=`( cd "$REPO_ROOT/.." && pwd )`
if [ ! -z "$GITHUB_CI" ]; then
sudo apt -y update
sudo apt-get -y install texlive texlive-latex-extra texlive-lang-czechslovak texlive-science texlive-pstricks latexmk texmaker texlive-font-utils texlive-fonts-extra texlive-bibtex-extra biber okular pdf-presenter-console dvipng sketch
sudo apt -y install poppler-utils imagemagick
fi
BACHELOR_DIR=$REPO_ROOT/bachelor_thesis
MASTER_DIR=$REPO_ROOT/master_thesis
PHD_DIR=$REPO_ROOT/phd_thesis
MASTER_OUTPUT_NAME=master_output
[ -e $REPO_ROOT/$MASTER_OUTPUT_NAME ] && rm -rf $REPO_ROOT/$MASTER_OUTPUT_NAME
mkdir -p $REPO_ROOT/$MASTER_OUTPUT_NAME/.fig
MASTER_OUTPUT_DIR=$REPO_ROOT/$MASTER_OUTPUT_NAME
cd $BACHELOR_DIR
rm -rf build
make
cd build
pdftoppm -jpeg main.pdf bachelor_thumbnail.jpg
montage *.jpg -mode Concatenate -tile 3x1 bachelor_montage.jpg
convert bachelor_montage-0.jpg -resize 1280 -quality 80 bachelor_montage-0.jpg
mv main.pdf $MASTER_OUTPUT_DIR/bachelor_thesis_template.pdf
mv bachelor_montage-0.jpg $MASTER_OUTPUT_DIR/.fig/bachelor_thesis_thumbnail.jpg
cd $BACHELOR_DIR
rm -rf build
cd $MASTER_DIR
rm -rf build
make
cd build
pdftoppm -jpeg main.pdf master_thumbnail.jpg
montage *.jpg -mode Concatenate -tile 3x1 master_montage.jpg
convert master_montage-0.jpg -resize 1280 -quality 80 master_montage-0.jpg
mv main.pdf $MASTER_OUTPUT_DIR/master_thesis_template.pdf
mv master_montage-0.jpg $MASTER_OUTPUT_DIR/.fig/master_thesis_thumbnail.jpg
cd $MASTER_DIR
rm -rf build
cd $PHD_DIR
rm -rf build
make
cd build
pdftoppm -jpeg main.pdf phd_thumbnail.jpg
montage *.jpg -mode Concatenate -tile 3x1 phd_montage.jpg
convert phd_montage-0.jpg -resize 1280 -quality 80 phd_montage-0.jpg
mv main.pdf $MASTER_OUTPUT_DIR/phd_thesis_template.pdf
mv phd_montage-0.jpg $MASTER_OUTPUT_DIR/.fig/phd_thesis_thumbnail.jpg
cd $PHD_DIR
rm -rf build
## --------------------------------------------------------------
## | copy stuff to the master output folder |
## --------------------------------------------------------------
cd $REPO_ROOT
rsync -vRP --copy-links README.md $MASTER_OUTPUT_DIR/
rsync -vRP --copy-links -r bachelor_thesis $MASTER_OUTPUT_DIR/
rsync -vRP --copy-links -r master_thesis $MASTER_OUTPUT_DIR/
rsync -vRP --copy-links -r phd_thesis $MASTER_OUTPUT_DIR/