docs/tutorial/prepare_pandoc.sh
changeset 5227 b24de4b465ea
parent 3376 aad37ffd7d58
equal deleted inserted replaced
5226:38d225efcea9 5227:b24de4b465ea
       
     1 #!/bin/bash
       
     2 set -euo pipefail
       
     3 
       
     4 # Prepare pandoc filters
       
     5 if [ -d pandocfilters/.git ]; then
       
     6     (cd pandocfilters && git remote update && git merge --ff-only)
       
     7 else
       
     8     git clone https://github.com/octobus-net/pandocfilters.git
       
     9 fi
       
    10 
       
    11 # Dependencies for pandoc and its filters itself
       
    12 python -m pip install pandocfilters
       
    13 python -m pip install panflute
       
    14 python -m pip install pygraphviz
       
    15 
       
    16 CMD_NOT_FOUND=0
       
    17 check_command() {
       
    18     cmd=$1
       
    19     if ! which "$cmd" >/dev/null 2>&1; then
       
    20         echo "Error: command '$cmd' not found in \$PATH"
       
    21         echo "Please install '$cmd'"
       
    22         CMD_NOT_FOUND=1
       
    23     else
       
    24         echo "$cmd command was found"
       
    25     fi
       
    26 }
       
    27 
       
    28 check_command pandoc
       
    29 
       
    30 if [ "$CMD_NOT_FOUND" -ne "0" ]; then
       
    31     exit 1
       
    32 fi