]> mj.ucw.cz Git - diplomky.git/blob - mkdist
README: Zmínka o latexmk
[diplomky.git] / mkdist
1 #!/bin/bash
2 set -e
3 export LC_ALL=cs_CZ
4
5 for a in bp dp phd ; do
6         rm -rf vzor-$a{,.zip}
7         git archive --prefix=vzor-$a/ HEAD | tar xf -
8         (
9                 cd vzor-$a
10                 rm -rf mkdist upload uprava slides TODO
11                 (
12                         date +'%Y-%m-%d'
13                         echo -n 'Git commit: '
14                         git rev-parse HEAD
15                 ) >VERSION
16         )
17 done
18
19 # BP
20 (
21         echo "Generating BP"
22         cd vzor-bp
23         sed -i '
24                 /^%\+ *ONLYPHD/N
25                 /^%\+ *PHDONLY/,/^%\+ *ONLYPHD/d
26                 /^%\+ *NOPHD/d
27                 /^%\+ *PHDNO/d
28         ' */*.tex README
29 )
30
31 # DP
32 (
33         echo "Generating DP"
34         cd vzor-dp
35         sed -i '
36                 s/bakalářsk/diplomov/g
37                 s/BAKALÁŘSK/DIPLOMOV/g
38                 s/bachelor/master/g
39                 s/BACHELOR/MASTER/g
40                 s/bp_uprava/dp_uprava/g
41                 /^%\+ *ONLYPHD/N
42                 /^%\+ *PHDONLY/,/^%\+ *ONLYPHD/d
43                 /^%\+ *NOPHD/d
44                 /^%\+ *PHDNO/d
45         ' */*.tex README
46         if grep -Eri 'bakal|bachel' . ; then
47                 echo >&2 "Substitutions failed"
48                 exit 1
49         fi
50 )
51
52 # PhD
53 (
54         echo "Generating PhD"
55         cd vzor-phd
56         sed -i '
57                 s/bakalářská/disertační/g
58                 s/bakalářské/disertační/g
59                 s/bakalářských/disertačních/g
60                 s/bakalářskou/disertační/g
61                 s/BAKALÁŘSKÁ/DISERTAČNÍ/g
62                 s/bachelor/doctoral/g
63                 s/BACHELOR/DOCTORAL/g
64                 s/bp_uprava/phd_uprava/g
65                 /^%\+ *PHDONLY/d
66                 /^%\+ *ONLYPHD/d
67                 /^%\+ *PHDNO/N
68                 /^%\+ *NOPHD/,/^%\+ *PHDNO/d
69         ' */*.tex README
70         if grep -Eri 'bakal|bachel' . ; then
71                 echo >&2 "Substitutions failed"
72                 exit 1
73         fi
74 )
75
76 for a in bp dp phd ; do
77         (
78                 cd vzor-$a/cs
79                 make
80                 mv prace.pdf vzor.pdf
81                 make clean
82         )
83         (
84                 cd vzor-$a/en
85                 make
86                 mv thesis.pdf example.pdf
87                 make clean
88         )
89         (
90                 cd vzor-$a
91                 sed -i '
92                         /^%\+ *NEMICEPS/N
93                         /^%\+ *SPECIMEN/,/^%\+ *NEMICEPS/d
94                         s/ *\\X{[^}]*}//
95                         /^\\XXX{/d
96                 ' */*.tex
97         )
98 done
99
100 for a in bp dp phd ; do
101         zip -r vzor-$a.zip vzor-$a
102 done