Dokumentation: Lx-Office in kivitendo umbenennen
[kivitendo-erp.git] / scripts / build_doc.sh
1 #!/bin/bash
2
3 # Usage:
4 #   cd /path/to/kivitendo
5 #   ./scripts/build_doc.sh
6
7 set -e
8
9 if [[ ! -d doc ]]; then
10   echo "Please run this from the installation directory."
11   exit 1
12 fi
13
14 doc=${PWD}/doc
15
16 html=1
17 pdf=1
18
19 if [[ ! -z $1 ]] ; then
20   html=0
21   pdf=0
22   while [[ ! -z $1 ]] ; do
23     case $1 in
24       html) html=1 ;;
25       pdf)  pdf=1  ;;
26       *)
27         echo "Unknown parameter $1"
28         exit 1
29         ;;
30     esac
31
32     shift
33   done
34 fi
35
36 dobudish=$(ls -d doc/build/dobudish* 2> /dev/null)
37
38 if [[ -z $dobudish ]] || [[ ! -d ${dobudish} ]]; then
39   echo "There's no dobudish directory inside doc/build."
40   exit 1
41 fi
42
43 cd ${dobudish}
44
45 base=documents/dokumentation
46 if [[ ! -d $base ]]; then
47   ./generator.sh dokumentation create book
48 fi
49
50 input=${base}/input
51 output=${base}/output
52 custom=${base}/custom-cfg
53
54 rm -rf ${input} ${custom}
55 mkdir ${input} ${input}/copy_to_output ${custom}
56
57 cp ${doc}/dokumentation.xml ${input}/
58 test -d ${doc}/images && cp -R ${doc}/images ${input}/copy_to_output/
59 cp -R ${doc}/build/custom-cfg/* ${custom}/
60
61 if [[ $pdf = 1 ]] ; then
62   ./generator.sh dokumentation pdf
63   cp ${output}/pdf/dokumentation.pdf ${doc}/kivitendo-Dokumentation.pdf
64 fi
65
66 if [[ $html = 1 ]]; then
67   ./generator.sh dokumentation html
68   rm -rf ${doc}/html
69   mkdir ${doc}/html
70   cp -R ${output}/html ${doc}/
71 fi