Code

Cleaned up code
[gosa.git] / gen_pdf_help.sh
1 #!/bin/sh
3 # Defaults for Debian
4 LYX=lyx-qt
6 # Sanity checks
7 if [ ! -d doc/guide/user ]; then
8         echo "Can't find usable documentation structure - aborting"
9         exit 1
10 fi
12 # Commands present?
13 for cmd in $LYX; do
14         if ! which $cmd &> /dev/null; then
15                 echo "Can't find executable for '$cmd' - aborting"
16                 exit 2
17         fi
18 done
20 pushd . &> /dev/null
21 cd doc/guide/user
23 for lang in *; do
24         [ ! -d "$lang" ] && continue
26         pushd . &> /dev/null
27         echo "Processing language $lang..."
28         cd $lang/lyx-source
30         for source in *.lyx; do
31                 $LYX -e pdf $source; d=../pdf/${source%%\.*}/; pdf=${source%lyx}pdf > /dev/null
32                 [ -d $d ] || mkdir -p $d && cp $pdf ../pdf/${source%%\.*}/ >/dev/null
33         done
35         popd &> /dev/null
36 done
38 popd &> /dev/null
39 echo
40 exit 0