aboutsummaryrefslogtreecommitdiff
path: root/bin/sphinx_update.sh
blob: 6d589667c925d822cde5aae54f77a7e806b1b77c (plain) (blame)
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
# This is more portable than `which' but comes with
# the caveat of not(?) properly working on busybox's ash:
existence()
{
    type "$1" >/dev/null 2>&1
}

sphinx_update()
{
    echo "Updating handbook..."
    if existence sphinx-build; then
      cwd=$PWD
      cd contrib/handbook || exit 1
      if test -e _build; then
        make clean
      fi
      # GNS
      make html >/dev/null || exit 1
      if test -e ../../doc/handbook/html; then
        rm -r ../../doc/handbook/html || exit 1
      fi
      cp -r _build/html ../../doc/handbook/ || exit 1
      if test -e ../../doc/handbook/texinfo; then
        rm -r ../../doc/handbook/texinfo || exit 1
      fi
      make info >/dev/null || exit 1
      cp -r _build/texinfo ../../doc/handbook/ || exit 1
      cd $cwd
    else
      echo "ERROR: Sphinx not found! Unable to generate recent documentation."
      exit 1
    fi
}

sphinx_update