#!/bin/sh
#8.06.11 rodin.s: i18n

export TEXTDOMAIN=xsaneshell #usr_sbin2
export TEXTDOMAINDIR=/usr/share/locale
export OUTPUT_CHARSET=UTF-8


COMMOUT="`cat /etc/sane.d/dll.conf | grep '^#[a-zA-Z0-9]' | tr '#' ' ' | tr '\n' ' '`"


xmessage -bg "orange" -center -title "$(gettext 'Frontend for Xsane')" -buttons "USB:10,Parallel:11,SCSI:12,$(gettext 'QUIT'):20" "$(gettext 'NOTE:')
`gettext \"The list of supported drivers is in text file /etc/sane.d/dll.conf
When Xsane starts, your scanner (if it is connected and turned on)
should be autodetected. However, some entries in 'dll.conf' are
commented-out. Here is the list of SANE drivers that are commented
-out in file 'dll.conf'\"`:

$COMMOUT

`gettext \"If your scanner is one of these, then Xsane will not auto-detect it.
-- in that case, click 'QUIT' button and open 'dll.conf' in a text
   editor and uncomment the appropriate entry.\"`
   
`gettext \"Xsane may be a bit 'insane' when detecting a SCSI scanner. There are
various things that you may have to do:\"`
`gettext \"1. Run 'sane-find-scanner' in a terminal window.\"`
`gettext \"2. Make sure 'sg' module is loaded.\"`
`gettext \"3. Specify the device on the commandline, ex:\"` # xsane microtek2:/dev/sg3
`gettext \"4. or maybe a symbolic link, ex:\"` # ln -s /dev/sg3 /dev/scanner

$(gettext 'To continue and run Xsane, answer this question:')
$(gettext 'Do you have a parallel-port, USB or SCSI scanner?')"

RETVAL=$?
case $RETVAL in
 10)
  #modprobe scanner
  #2.6 kernel does not have module 'scanner'. instead relies on libusb.
  echo
  ;;
 11)
  modprobe parport_pc
  ;;
 12)
  modprobe sg
  ;;
 *)
  exit
  ;;
esac

sleep 1
exec xsane
