#!/bin/sh
## Script to build a html slide show where the slides are nicely formated
## JPEG images

dir=200206_ltk
file=ltk

MGPPATH=/usr/bin/X11/mgp

lang=$(locale | sed -ne 's/"$//;s/^LC_MESSAGES="\?/\1/p')
l=$(sed -ne "s/^$(echo $lang | sed 's/\([].^$*[]\)/\\\1/g')[ 	]\+//ip" /etc/locale.alias)
[ -n "$l" ] && lang="$l"

case "$lang" in
  de*)
        DEBVER="Sie verwenden nicht die Debian-Version von Magicpoint.\nIm Fall von Problemen installieren Sie diese bitte mittels:"
        MGPINST="Sie mssen Magicpoint installieren, um die HTML-Seiten zu erzeugen.\nSie knnen das mittels:"
     ;;
  *)
        DEBVER="You are not using the Debian packages version of Magicpoint.\nIn case of problems please install it using:"
        MGPINST="You have to install Magicpint via:"
     ;;
esac

if [ ! -f ${MGPPATH} ] ; then
  MGP=`which mgp`
  if [ "_${MGP}_" == "__" ] ; then
    echo -e "\n\n${DEBVER}"
    echo "        apt-get install mgp"
  else
    echo -e "\n\n${MGPINST}"
    echo "        apt-get install mgp"
    exit
  fi
fi

cp -a /usr/share/doc/med-doc/talks/${dir}/${file}.mgp.gz /tmp
cp -a /usr/share/doc/med-doc/talks/${dir}/style.mgp /tmp
rm -fr /tmp/${file}.mgp html
gunzip /tmp/${file}.mgp.gz
mkdir -p html
${MGPPATH} -x vflib -D html /tmp/${file}.mgp

echo HTML build succeded.  You can find the pages under /tmp/html.
