author | Boris Feld <boris.feld@octobus.net> |
Wed, 18 Dec 2019 14:10:56 +0100 | |
changeset 5228 | cfabc3c4aa10 |
parent 5227 | b24de4b465ea |
permissions | -rwxr-xr-x |
3376
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
1 |
#!/bin/bash |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 |
set -euo pipefail |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 |
|
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 |
# Prepare pandoc filters |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
5 |
if [ -d pandocfilters/.git ]; then |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
6 |
(cd pandocfilters && git remote update && git merge --ff-only) |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
7 |
else |
5227
b24de4b465ea
ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
3376
diff
changeset
|
8 |
git clone https://github.com/octobus-net/pandocfilters.git |
3376
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
9 |
fi |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
10 |
|
5227
b24de4b465ea
ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
3376
diff
changeset
|
11 |
# Dependencies for pandoc and its filters itself |
b24de4b465ea
ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
3376
diff
changeset
|
12 |
python -m pip install pandocfilters |
b24de4b465ea
ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
3376
diff
changeset
|
13 |
python -m pip install panflute |
b24de4b465ea
ci: Add CI job for building the documentation
Boris Feld <boris.feld@octobus.net>
parents:
3376
diff
changeset
|
14 |
python -m pip install pygraphviz |
3376
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
15 |
|
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
16 |
CMD_NOT_FOUND=0 |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
17 |
check_command() { |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 |
cmd=$1 |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
19 |
if ! which "$cmd" >/dev/null 2>&1; then |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 |
echo "Error: command '$cmd' not found in \$PATH" |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 |
echo "Please install '$cmd'" |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 |
CMD_NOT_FOUND=1 |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
23 |
else |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
24 |
echo "$cmd command was found" |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
25 |
fi |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
26 |
} |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
27 |
|
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
28 |
check_command pandoc |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
29 |
|
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
30 |
if [ "$CMD_NOT_FOUND" -ne "0" ]; then |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
31 |
exit 1 |
aad37ffd7d58
doc: import the training support
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
32 |
fi |