#!/bin/sh
#Scanner Wizard (c) Barry Kauler 2003 www.goosee.com/puppy
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)

#SCRIPT NOT FINISHED

#this script creates /etc/scanner, which has format driver[:device].
#note, we could also have /dev/scanner linked to device.

#display window with driver info...
#dillo "file:///usr/share/doc/sane/sane-backends.htm" &
defaultbrowser "http://www.mostang.com/sane/sane-backends.html" &
sleep 1

setvar STATUSabaton = ""off""
setvar STATUSagfafocus = ""off""
setvar STATUSapple = ""off""
setvar STATUSartec = ""off""
setvar STATUSartec_eplus48u = ""off""
setvar STATUSas6e = ""off""
setvar STATUSavision = ""off""
setvar STATUSbh = ""off""
setvar STATUScanon = ""off""
setvar STATUScanon630u = ""off""
setvar STATUScanon_pp = ""off""
setvar STATUScoolscan = ""off""
setvar STATUScoolscan2 = ""off""
setvar STATUSepson = ""off""
setvar STATUSfujitsu = ""off""
setvar STATUSgt68xx = ""off""
setvar STATUShp = ""off""
setvar STATUShpsj5s = ""off""
setvar STATUSibm = ""off""
setvar STATUSleo = ""off""
setvar STATUSma1509 = ""off""
setvar STATUSmatsushita = ""off""
setvar STATUSmicrotek = ""off""
setvar STATUSmicrotek2 = ""off""
setvar STATUSmustek = ""off""
setvar STATUSmustek_pp = ""off""
setvar STATUSmustek_usb = ""off""
setvar STATUSnec = ""off""
setvar STATUSpie = ""off""
setvar STATUSplustek = ""off""
setvar STATUSricoh = ""off""
setvar STATUSs9036 = ""off""
setvar STATUSsceptre = ""off""
setvar STATUSsharp = ""off""
setvar STATUSsm3600 = ""off""
setvar STATUSsnapscan = ""off""
setvar STATUSsp15c = ""off""
setvar STATUSst400 = ""off""
setvar STATUStamarack = ""off""
setvar STATUSteco1 = ""off""
setvar STATUSteco2 = ""off""
setvar STATUSteco3 = ""off""
setvar STATUSumax = ""off""
setvar STATUSumax1220u = ""off""
setvar STATUSumax_pp = ""off""

if test -e /etc/scanner{
 #/etc/scanner may have a format of drive:device...
 setvar CURRENTSCANNER = "$(cat /etc/scanner | cut -f 1 -d ":)"
# STATUS$CURRENTSCANNER="on"
case (CURRENTSCANNER) {
 abaton  { setvar STATUSabaton = ""on"" }
 agfafocus  { setvar STATUSagfafocus = ""on"" }
 apple  { setvar STATUSapple = ""on"" }
 artec  { setvar STATUSartec = ""on"" }
 artec_eplus48u  { setvar STATUSartec_eplus48u = ""on"" }
 as6e  { setvar STATUSas6e = ""on"" }
 avision  { setvar STATUSavision = ""on"" }
 bh  { setvar STATUSbh = ""on"" }
 canon  { setvar STATUScanon = ""on"" }
 canon630u  { setvar STATUScanon630u = ""on"" }
 canon_pp  { setvar STATUScanon_pp = ""on"" }
 coolscan  { setvar STATUScoolscan = ""on"" }
 coolscan2  { setvar STATUScoolscan2 = ""on"" }
 epson  { setvar STATUSepson = ""on"" }
 fujitsu  { setvar STATUSfujitsu = ""on"" }
 gt68xx  { setvar STATUSgt68xx = ""on"" }
 hp  { setvar STATUShp = ""on"" }
 hpsj5s  { setvar STATUShpsj5s = ""on"" }
 ibm  { setvar STATUSibm = ""on"" }
 leo  { setvar STATUSleo = ""on"" }
 ma1509  { setvar STATUSma1509 = ""on"" }
 matsushita  { setvar STATUSmatsushita = ""on"" }
 microtek  { setvar STATUSmicrotek = ""on"" }
 microtek2  { setvar STATUSmicrotek2 = ""on"" }
 mustek  { setvar STATUSmustek = ""on"" }
 mustek_pp  { setvar STATUSmustek_pp = ""on"" }
 mustek_usb  { setvar STATUSmustek_usb = ""on"" }
 nec  { setvar STATUSnec = ""on"" }
 pie  { setvar STATUSpie = ""on"" }
 plustek  { setvar STATUSplustek = ""on"" }
 ricoh  { setvar STATUSricoh = ""on"" }
 s9036  { setvar STATUSs9036 = ""on"" }
 sceptre  { setvar STATUSsceptre = ""on"" }
 sharp  { setvar STATUSsharp = ""on"" }
 sm3600  { setvar STATUSsm3600 = ""on"" }
 snapscan  { setvar STATUSsnapscan = ""on"" }
 sp15c  { setvar STATUSsp15c = ""on"" }
 st400  { setvar STATUSst400 = ""on"" }
 tamarack  { setvar STATUStamarack = ""on"" }
 teco1  { setvar STATUSteco1 = ""on"" }
 teco2  { setvar STATUSteco2 = ""on"" }
 teco3  { setvar STATUSteco3 = ""on"" }
 umax  { setvar STATUSumax = ""on"" }
 umax1220u  { setvar STATUSumax1220u = ""on"" }
 umax_pp  { setvar STATUSumax_pp = ""on"" }
}
}

setvar RESULTOK = "$(Xdialog --wmclass "scannerwizard" --title "Puppy scanner wizard" --stdout \
 --radiolist "Read doc window then choose scanner driver..." 28 65 4 \
 "abaton" "Abaton" $STATUSabaton \
 "agfafocus"   "Agfa, Siemens"   $STATUSagfafocus   \
 "apple"  "Apple" $STATUSapple  \
 "artec"   "Artec/Ultima, BlackWidow,Plustek"   $STATUSartec   \
 "artec_eplus48u"  "Artec/Ultima, Medion(etc),Trust,Memorex,Umax" $STATUSartec_eplus48u \
 "as6e" "Artec/Ultima" $STATUSas6e \
 "avision" "Avision, HP,Minolta,Mitsubishi,Fujitsu" $STATUSavision \
 "bh" "Bell and Howell" $STATUSbh \
 "canon" "Canon" $STATUScanon \
 "canon630u" "Canon" $STATUScanon630u \
 "canon_pp" "Canon" $STATUScanon_pp \
 "coolscan" "Nikon" $STATUScoolscan \
 "coolscan2" "Nikon" $STATUScoolscan2 \
 "epson" "Epson" $STATUSepson \
 "fujitsu" "Fujitsu" $STATUSfujitsu \
 "gt68xx" "Mustek, Plustek,Artec,Boeder,PkdBell,Medion,Trust,Lexmark,Genius" $STATUSgt68xx \
 "hp" "Hewlett Packard, Photosmart/scanner" $STATUShp \
 "hpsj5s" "Hewlett Packard" $STATUShpsj5s \
 "ibm" "IBM, Ricoh" $STATUSibm \
 "leo" "LEO, Across Technologies, Genius" $STATUSleo \
 "ma1509" "Mustek" $STATUSma1509 \
 "matsushita" "Panasonic" $STATUSmatsushita \
 "microtek" "Microtek, Agfa" $STATUSmicrotek \
 "microtek2" "Microtek, Vobis,Scanport" $STATUSmicrotek2 \
 "mustek" "Mustek, Trust,Primax" $STATUSmustek \
 "mustek_pp" "Mustek, Medion(etc),Targa,Trust,Viviscan,Cybercom,Gallery" $STATUSmustek_pp \
 "mustek_usb" "Mustek, Trust" $STATUSmustek_usb \
 "nec" "NEC" $STATUSnec \
 "pie" "PIE, Devcom,Adlib" $STATUSpie \
 "plustek" "Plustek, Primax,Genius,Aries,B-Scan,Mustek,HP,Epson,Umax,Compaq,Canon" $STATUSplustek \
 "ricoh" "Ricoh" $STATUSricoh \
 "s9036" "Siemens" $STATUSs9036 \
 "sceptre" "Sceptre, Komodo" $STATUSsceptre \
 "sharp" "Sharp" $STATUSsharp \
 "sm3600" "Microtek" $STATUSsm3600 \
 "snapscan" "Agfa, Benq,Guillemot,Mitsubishi,Epson" $STATUSsnapscan \
 "sp15c" "Fijitsu" $STATUSsp15c \
 "st400" "Siemens" $STATUSst400 \
 "tamarack" "Tamarack" $STATUStamarack \
 "teco1" "Relisys, Actown,Dextra" $STATUSteco1 \
 "teco2" "Relisys, Primax" $STATUSteco2 \
 "teco3" "Relisys, Plustek,Piotech,Trust" $STATUSteco3 \
 "umax" "Umax, Linotype Hell,Vobis,Edge,Epson,Escom,Escort,Genius,Nikon" $STATUSumax \
 "umax1220u" "Umax" $STATUSumax1220u \
 "umax_pp" "Umax" $STATUSumax_pp  )"

setvar STATUSRET = ""$?

if test $STATUSRET -eq 0{
 echo -n $RESULTOK > /etc/scanner
 Xdialog --wmclass "scannerwizard" --title "Puppy scanner wizard" \
 --infobox "SCRIPT NOT FINISHED. DOESN'T ACTUALLY DO ANYTHING!" \
 8 50 10000 2> /dev/null
}