#!/bin/bash
#
# install-info - TurboPrint installation script
#                print user information
#
# must have root permissions
#
# (c) 2000-2002 ZEDOnet

# get TurboPrint configuration

eval $(cat system.cfg)

TP_RPM=0

for i do
	case "$i" in
	--rpm ) TP_RPM=1;;
	--cups=* ) TP_CUPS=${i#*=};;
	--language=* ) TP_LANGUAGE=${i#*=};;
	esac
done

if [ $TP_LANGUAGE != "de" ] ; then

TP_CHECK_SHARED="Checking shared libraries:"
TP_CHECK_SHARED1="(add missing libraries with your package manager)"
TP_CHECK_FILTER="Checking filter programs:"
TP_CHECK_FILTER1="(if required, add missing packages with your package manager)"
TP_FOUND="    found         "
TP_NTFND="NOT FOUND         "
TP_OPTIO="not found (option)"
TP_GHOST="(needed for PS,PDF,FIG,DVI,troff,html,ASCII)"
TP_FILE="(file type recognition)"
TP_PSUTILS="(of psutils package, needed for duplex printing)"
TP_ZCAT="(needed for printing of gzip compressed files)"
TP_ASCII="** printing of ASCII documents not possible"
TP_COMPLETE="Installation completed"

else

TP_CHECK_SHARED="Überprüfe shared libraries:"
TP_CHECK_SHARED1="(fehlende Libraries bitte nachinstallieren)"
TP_CHECK_FILTER="Überprüfe Filterprogramme für Dateiformatumwandlung:"
TP_CHECK_FILTER1="(fehlende Pakete bei Bedarf nachinstallieren)"
TP_FOUND=" gefunden          "
TP_NTFND="NICHT GEFUNDEN     "
TP_OPTIO="nicht gef. (Option)"
TP_GHOST="(notwendig für PS,PDF,FIG,DVI,troff,html,ASCII)"
TP_FILE="(Dateityperkennung)"
TP_PSUTILS="(aus psutils Paket, notwendig für Duplexdruck)"
TP_ZCAT="(notwendig zum Druck komprimierter Dateien)"
TP_ASCII="** Ausdruck von ASCII Dateien nicht möglich"
TP_COMPLETE="Installation abgeschlossen"

fi

# check presence of filters

echo ""
echo "$TP_CHECK_SHARED"
echo "$TP_CHECK_SHARED1"
echo ""
set -- $(ldd "$TPPATH_BIN/xtpconfig" | sed -e 's/\ /:/g;')
for i do
  case "$i" in
  *gtk*not* )     echo "* gtk     library NOT found";;
  *gtk* )         echo "  gtk     library     found";;
  *gdk*not* )     echo "* gdk     library NOT found (part of gtk)";;
  *gmodule*not* ) echo "* gmodule library NOT found (part of gtk)";;
  *glib*not* )    echo "* gmodule library NOT found (part of gtk)";;
  *dl*not* )      echo "* dl      library NOT found (part of gtk)";;
  esac
done
echo ""
echo "$TP_CHECK_FILTER"
echo "$TP_CHECK_FILTER1"
echo ""

type gs &> /dev/null        && echo "  gs        $TP_FOUND $TP_GHOST"
type gs &> /dev/null        || echo "* gs        $TP_NTFND $TP_GHOST"

# the following filters are not required for CUPS
if [ -z $TP_CUPS -o $TP_CUPS -eq 0 ] ; then

type file &> /dev/null    && echo "  file      $TP_FOUND $TP_FILE"
type file &> /dev/null    || echo "* file      $TP_NTFND $TP_FILE"
type zcat &> /dev/null      && echo "  zcat      $TP_FOUND $TP_ZCAT"
type zcat &> /dev/null      || echo "* zcat      $TP_OPTIO $TP_ZCAT"
type pstops &> /dev/null    && echo "  pstops    $TP_FOUND $TP_PSUTILS"
type pstops &> /dev/null    || echo "* pstops    $TP_OPTIO $TP_PSUTILS"
type fig2dev &> /dev/null   && echo "  fig2dev   $TP_FOUND (FIG drawings)"
type fig2dev &> /dev/null   || echo "* fig2dev   $TP_OPTIO (FIG drawings)"
type dvips &> /dev/null     && echo "  dvips     $TP_FOUND (TeX DVI documents)"
type dvips &> /dev/null     || echo "* dvips     $TP_OPTIO (TeX DVI documents)"
type grog &> /dev/null      && echo "  grog      $TP_FOUND (troff, man documents)"
type grog &> /dev/null      || echo "* grog      $TP_OPTIO (troff, man documents)"
type html2ps &> /dev/null   && echo "  html2ps   $TP_FOUND (HTML internet pages)"
type html2ps &> /dev/null   || echo "* html2ps   $TP_OPTIO (HTML internet pages)"
type bmptoppm &> /dev/null  && echo "  bmptoppm  $TP_FOUND (BMP pictures)"
type bmptoppm &> /dev/null  || echo "* bmptoppm  $TP_OPTIO (BMP pictures)"
type tifftopnm &> /dev/null && echo "  tifftopnm $TP_FOUND (TIFF pictures)"
type tifftopnm &> /dev/null || echo "* tifftopnm $TP_OPTIO (TIFF pictures)"
type giftopnm &> /dev/null  && echo "  giftopnm  $TP_FOUND (GIF pictures)"
type giftopnm &> /dev/null  || echo "* giftopnm  $TP_OPTIO (GIF pictures)"
type djpeg &> /dev/null     && echo "  djpeg     $TP_FOUND (JPEG pictures)"
type djpeg &> /dev/null     || echo "* djpeg     $TP_OPTIO (JPEG pictures)"
type rasttopnm &> /dev/null && echo "  rasttopnm $TP_FOUND (Sunraster pictures)"
type rasttopnm &> /dev/null || echo "* rasttopnm $TP_OPTIO (Sunraster pictures)"
type pngtopnm &> /dev/null  && echo "  pngtopnm  $TP_FOUND (PNG pictures)"
type pngtopnm &> /dev/null  || echo "* pngtopnm  $TP_OPTIO (PNG pictures)"
type xpmtoppm &> /dev/null  && echo "  xpmtoppm  $TP_FOUND (XPM pictures)"
type xpmtoppm &> /dev/null  || echo "* xpmtoppm  $TP_OPTIO (XPM pictures)"
type a2ps &> /dev/null      && echo "  a2ps      $TP_FOUND (ASCII text documents)"
type a2ps &> /dev/null      || echo "* a2ps      $TP_OPTIO (ASCII text documents)"
type enscript &> /dev/null  && echo "  enscript  $TP_FOUND (ASCII text documents)"
type enscript &> /dev/null  || echo "* enscript  $TP_OPTIO (ASCII text documents)"
type a2ps &> /dev/null      || type enscript &> /dev/null || echo "$TP_ASCII"
else
type lp &> /dev/null     && echo "  lp        $TP_FOUND (command line printing)"
type lp &> /dev/null     || echo "* lp        $TP_NTFND (command line printing - install package cupsys-client)"

fi

echo ""

echo "$TP_COMPLETE"

# finished

exit 0
