]> mj.ucw.cz Git - diplomky.git/blob - mkdist
Komentář na informační stránce upozorňuje na README
[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         ' */*.tex README
27 )
28
29 # DP
30 (
31         echo "Generating DP"
32         cd vzor-dp
33         sed -i '
34                 s/bakalářsk/diplomov/g
35                 s/BAKALÁŘSK/DIPLOMOV/g
36                 s/bachelor/master/g
37                 s/BACHELOR/MASTER/g
38                 s/bp_uprava/dp_uprava/g
39                 /^%\+ *ONLYPHD/N
40                 /^%\+ *PHDONLY/,/^%\+ *ONLYPHD/d
41         ' */*.tex README
42         if grep -Eri 'bakal|bachel' . ; then
43                 echo >&2 "Substitutions failed"
44                 exit 1
45         fi
46 )
47
48 # PhD
49 (
50         echo "Generating PhD"
51         cd vzor-phd
52         sed -i '
53                 s/bakalářská/disertační/g
54                 s/bakalářské/disertační/g
55                 s/bakalářských/disertačních/g
56                 s/bakalářskou/disertační/g
57                 s/BAKALÁŘSKÁ/DISERTAČNÍ/g
58                 s/bachelor/doctoral/g
59                 s/BACHELOR/DOCTORAL/g
60                 s/bp_uprava/phd_uprava/g
61                 / Následuje vevázaný /,+2d
62                 /^%\+ *PHDONLY/d
63                 /^%\+ *ONLYPHD/d
64         ' */*.tex README
65         if grep -Eri 'bakal|bachel' . ; then
66                 echo >&2 "Substitutions failed"
67                 exit 1
68         fi
69 )
70
71 for a in bp dp phd ; do
72         (
73                 cd vzor-$a/cs
74                 make
75                 mv prace.pdf vzor.pdf
76                 make clean
77         )
78         (
79                 cd vzor-$a/en
80                 make
81                 mv thesis.pdf example.pdf
82                 make clean
83         )
84         (
85                 cd vzor-$a
86                 sed -i '
87                         /^%\+ *NEMICEPS/N
88                         /^%\+ *SPECIMEN/,/^%\+ *NEMICEPS/d
89                         s/ *\\X{[^}]*}//
90                         /^\\XXX{/d
91                 ' */*.tex
92         )
93 done
94
95 for a in bp dp phd ; do
96         zip -r vzor-$a.zip vzor-$a
97 done