#!/bin/bash
#
# batch file to setup filter
#

################################################################################
#
# echo informations
#

echo
echo "    Warning...!"
echo "    <TSC Printer Driver> uninstall"
echo
echo "    please use <printconf-gui> or <printconf-tui> to remove all printers"
echo "        based on the driver and then close the program!"
echo -n "    input 'y' to continue:"
read inputval
if test "$inputval" != "y"
then
  echo "    uninstall be canceled"
  echo
  exit 1
fi

################################################################################
#
# echo informations
#
echo "    remove files......"
rm -rf /usr/lib/cups/filter/pstotspl
rm -rf /usr/lib/cups/filter/pstotspl2

rm -rf /usr/share/cups/model/tsc/*.ppd
rm -rf /usr/local/share/tsc/printer/uninstall-driver
rm -rf /usr/local/share/tsc/printer/thermalprinterui
rm -rf /usr/local/share/tsc/printer/thermalprinterut
rm -rf /usr/local/share/tsc/printer/thermalprinterui.png

if test -f /usr/share/applications/tscprintersetting.desktop
then
  rm -rf /usr/share/applications/tscprintersetting.desktop
fi

echo "    restart spooler - CUPS"
################################################################################
#
# restart 
#
if test -f /etc/init.d/cups
then
  /etc/init.d/cups restart
else
  if test -f /etc/init.d/cupsys
  then
    /etc/init.d/cupsys restart
  fi
fi

################################################################################
#
# echo informations
#

echo "    uninstall driver completed"
echo

exit 0


