]> wagnertech.de Git - mfinanz.git/blobdiff - scripts/build_doc.sh
restart apache2 in postinst
[mfinanz.git] / scripts / build_doc.sh
index be8e9252e2c926bb3527116597a537adc11f33ce..0c4f48ef523639bd4f960ba2f945c7f6f75c1db7 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Usage:
-#   cd /path/to/lx-office
+#   cd /path/to/kivitendo
 #   ./scripts/build_doc.sh
 
 set -e
@@ -13,16 +13,26 @@ fi
 
 doc=${PWD}/doc
 
+if [[ ! -d doc/build/dobudish ]]; then
+  echo "  ERROR: looks like 'doc/build/dobudish' DIR is missing"
+  echo "   - You need to get 'dobudish-nojre-1.1.4.zip' from https://code.google.com/archive/p/dobudish/downloads"
+  echo "   - Download and unpack ( unzip dobudish-nojre-1.1.4.zip -d doc/build )"
+  echo "   - create dobudish symlink ( ln -sf dobudish-1.1.4 doc/build/dobudish )"
+fi
+
 html=1
 pdf=1
+images=1
 
 if [[ ! -z $1 ]] ; then
   html=0
   pdf=0
+  images=0
   while [[ ! -z $1 ]] ; do
     case $1 in
-      html) html=1 ;;
-      pdf)  pdf=1  ;;
+      html)   html=1   ;;
+      pdf)    pdf=1    ;;
+      images) images=1 ;;
       *)
         echo "Unknown parameter $1"
         exit 1
@@ -33,14 +43,7 @@ if [[ ! -z $1 ]] ; then
   done
 fi
 
-dobudish=$(ls -d doc/build/dobudish* 2> /dev/null)
-
-if [[ -z $dobudish ]] || [[ ! -d ${dobudish} ]]; then
-  echo "There's no dobudish directory inside doc/build."
-  exit 1
-fi
-
-cd ${dobudish}
+cd doc/build/dobudish
 
 base=documents/dokumentation
 if [[ ! -d $base ]]; then
@@ -55,12 +58,12 @@ rm -rf ${input} ${custom}
 mkdir ${input} ${input}/copy_to_output ${custom}
 
 cp ${doc}/dokumentation.xml ${input}/
-test -d ${doc}images && cp -R ${doc}/images ${input}/copy_to_output/
+test -d ${doc}/images && cp -R ${doc}/images ${input}/copy_to_output/
 cp -R ${doc}/build/custom-cfg/* ${custom}/
 
 if [[ $pdf = 1 ]] ; then
   ./generator.sh dokumentation pdf
-  cp ${output}/pdf/dokumentation.pdf ${doc}/Lx-Office-Dokumentation.pdf
+  cp ${output}/pdf/dokumentation.pdf ${doc}/kivitendo-Dokumentation.pdf
 fi
 
 if [[ $html = 1 ]]; then
@@ -69,3 +72,15 @@ if [[ $html = 1 ]]; then
   mkdir ${doc}/html
   cp -R ${output}/html ${doc}/
 fi
+
+if [[ $images = 1 ]]; then
+  # copy system images from Dobudish directory
+  image_list=$(mktemp)
+  perl -nle 'print $1 while m{ (?: \.\./ )+ ( system/ [^\"]+ ) }xg' ${doc}/html/*.html | sort | uniq > $image_list
+  if [[ -s $image_list ]]; then
+    tar -c -f - -T $image_list | tar -x -f - -C ${doc}/html
+    perl -pi -e 's{ (\.\./)+ system }{system}xg' ${doc}/html/*.html
+  fi
+
+  rm $image_list
+fi