From b24b95c6909857fb9481df725fd3cbcd65b2a547 Mon Sep 17 00:00:00 2001 From: Max-Julian Pogner Date: Fri, 3 Sep 2021 17:51:30 +0200 Subject: [PATCH 1/5] correctly set executable bit on shell scripts --- build-all.sh | 0 build-thesis.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build-all.sh mode change 100644 => 100755 build-thesis.sh diff --git a/build-all.sh b/build-all.sh old mode 100644 new mode 100755 diff --git a/build-thesis.sh b/build-thesis.sh old mode 100644 new mode 100755 -- GitLab From 8a4dd75de9cf030fa177e1a5bc9887027a4cec6d Mon Sep 17 00:00:00 2001 From: Max-Julian Pogner Date: Fri, 3 Sep 2021 17:54:05 +0200 Subject: [PATCH 2/5] exclude build artifacts from git tracking --- .gitignore | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a881a3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +*.acn +*.acr +*.alg +*.aux +*.bbl +*.blg +*.cls +*.glg +*.glo +*.gls +*.glsdefs +*.hd +*.idx +*.ilg +*.ind +*.ist +*.loa +*.lof +*.log +*.lot +*.out +*.toc +example.pdf +vutinfth.pdf \ No newline at end of file -- GitLab From bf483001769043c2e8f4a1d7cb638746b2c122b6 Mon Sep 17 00:00:00 2001 From: Max-Julian Pogner Date: Fri, 3 Sep 2021 17:55:29 +0200 Subject: [PATCH 3/5] correctly quote variable with possible spaces --- build-thesis.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build-thesis.sh b/build-thesis.sh index 2787aa7..cb23b1f 100755 --- a/build-thesis.sh +++ b/build-thesis.sh @@ -5,15 +5,15 @@ SOURCE=x # Build the thesis document -pdflatex $SOURCE -bibtex $SOURCE -pdflatex $SOURCE -pdflatex $SOURCE -makeindex -t $SOURCE.glg -s $SOURCE.ist -o $SOURCE.gls $SOURCE.glo -makeindex -t $SOURCE.alg -s $SOURCE.ist -o $SOURCE.acr $SOURCE.acn -makeindex -t $SOURCE.ilg -o $SOURCE.ind $SOURCE.idx -pdflatex $SOURCE -pdflatex $SOURCE +pdflatex "$SOURCE" +bibtex "$SOURCE" +pdflatex "$SOURCE" +pdflatex "$SOURCE" +makeindex -t "$SOURCE.glg" -s "$SOURCE.ist" -o "$SOURCE.gls" "$SOURCE.glo" +makeindex -t "$SOURCE.alg" -s "$SOURCE.ist" -o "$SOURCE.acr" "$SOURCE.acn" +makeindex -t "$SOURCE.ilg" -o "$SOURCE.ind" "$SOURCE.idx" +pdflatex "$SOURCE" +pdflatex "$SOURCE" echo echo -- GitLab From 2a6ec208601efd0549fa23ed8ad4e5d3ee69b073 Mon Sep 17 00:00:00 2001 From: Max-Julian Pogner Date: Fri, 3 Sep 2021 18:03:03 +0200 Subject: [PATCH 4/5] build-thesis: communicate user-provided value via CLI, support directory --- build-thesis.sh | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/build-thesis.sh b/build-thesis.sh index cb23b1f..456832c 100755 --- a/build-thesis.sh +++ b/build-thesis.sh @@ -1,8 +1,41 @@ #!/bin/sh # Copyright (C) 2014-2020 by Thomas Auzinger -# Replace the 'x' in the next line with the name of the thesis' main LaTeX document without the '.tex' extension -SOURCE=x +usage() { + echo "Usage: $0 path/to/THESIS.tex" >&2 +} + +# parse command line argument for the "SOURCE" variable value +SOURCE= +WORKDIR= +while [ $# -ge 1 ]; +do + arg="$1" + case "$arg" in + -h|--help) + usage + exit 1 + ;; + *) + # the value of SOURCE is the given file name without the '.tex' + # extension. + # the value of WORKDIR is the directory where the filename + # resides. + SOURCE="$(basename "$arg" .tex)" + WORKDIR="$(dirname "$arg")" + ;; + esac + shift +done + +[ -n "$SOURCE" ] || { + usage + exit 1 +} + +cd "$WORKDIR" + +echo "building thesis '$SOURCE' in directory '$WORKDIR'" >&2 # Build the thesis document pdflatex "$SOURCE" -- GitLab From adfc35efa1a188367014f3d6ef5fb192189b118c Mon Sep 17 00:00:00 2001 From: Max-Julian Pogner Date: Fri, 3 Sep 2021 18:11:00 +0200 Subject: [PATCH 5/5] print logging to stderr, as seems to be usual in unix environment --- build-thesis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-thesis.sh b/build-thesis.sh index 456832c..0004e2a 100755 --- a/build-thesis.sh +++ b/build-thesis.sh @@ -48,6 +48,6 @@ makeindex -t "$SOURCE.ilg" -o "$SOURCE.ind" "$SOURCE.idx" pdflatex "$SOURCE" pdflatex "$SOURCE" -echo -echo -echo Thesis document compiled. +echo >&2 +echo >&2 +echo Thesis document compiled. >&2 -- GitLab