-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-tds.sh
executable file
·57 lines (40 loc) · 1.08 KB
/
generate-tds.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
#
# Generate a TDS compliant zip
#
REMOVE_OUT=false
while getopts 'abf:v' flag; do
case "${flag}" in
RemoveOut) REMOVE_OUT=true ;;
*) break ;;
esac
done
out="tdsout"
in="latex"
latex="$out/tex/latex/ugent2016"
doc="$out/doc/latex/ugent2016"
source="$out/source/latex/ugent2016"
mkdir -p ${latex}
mkdir -p ${doc}
mkdir -p ${source}
# Copy all latex files
find ${in} \( -name '*.cls' -o -name '*.sty' \) -exec cp "{}" ${latex} ";"
# Copy all doc files
find ${in} -name '*.md' -exec cp "{}" ${doc} ";"
# Copy all source files
find ${in} -name '*.tex' -exec cp "{}" ${source} ";"
# Convert all line endings
find ${out} -type f -print0 | xargs -0 dos2unix
# Copy logos
find ${in} -name 'ugent2016-logo-*.pdf' -exec cp "{}" ${latex} ";"
# Copy the documentation pdfs to the folder
cp "$in/ugent2016-nl.pdf" ${doc}
cp "$in/ugent2016-en.pdf" ${doc}
# Fix all permissions
find ${out} -type f -exec chmod 644 "{}" ";"
cd ${out} || exit
zip --filesync -r ../ugent2016.tds.zip *
chmod 644 ../ugent2016.tds.zip
if [[ "$REMOVE_OUT" = true ]]; then
rm -rf ${out}
fi