Linux Kiosk Printer Detection & Script modification

I have a situation where I have built a boot-able CD-ROM based on Ubuntu 5.10. The boot-able CD is working great, but I have this one little thing that I think should be possible but just don't know for sure so I thought I would ask you guys.

When booting the CD-ROM, this is what happens:
The CD Boots, Ubuntu does its thing and loads all the gory tech stuff, and it auto logs in as user Ubuntu.
I have modified parts of the Gnome desktop (specifically the sessions StartUp Programs) to run a script called kisok_setup for me when the user loads. I use this kiosk_setup script to build all my generic printers, and to launce the web browser and acrobat reader (this Kiosk is being set up as Print Station for a MFG plant). As I said everything works fine and I have a working model now. When the kiosk_setup is run, it adds:

1 parallel laserjet (hp compatible)
1 USB laserjet (hp & Linux compatible)
3 known network printers (strategically placed in the plant)

right now, I have to make 2 CD's, one where the default printer is parallel the other where the default printer is USB.

So my question is - does anyone know if there is anyway I could check to see if in fact there is a USB or Parallel printer connected to the PC after it boots (during the execution of kiosk_setup) then make that detected printer the default?

For the kiosk_setup script I am using bash, and this is basically all it does for the printers:

# Printers
# Add a parallel laserjet
lpadmin -p ParaLaser -L WebKiosk -E -v parallel:/dev/lp0 -m laserjet.ppd
# Set parallel printer options
lpoptions -p ParaLaser -o media=letter

# Add a usb laserjet (tested with hplj 1012)
lpadmin -p USBLaser -L WebKiosk -E -v usb:/dev/usb/lp0 -m laserjet.ppd
# Set usb printer options
lpoptions -p USBLaser -o media=letter

# Setting the default printer
lpoptions -d ParaLaser

or for the second CD

# Setting the default printer
lpoptions -d USBLaser

Thanks in advance for any suggestions.
NTNBowerAsked:
Who is Participating?
 
edkim80Commented:
I would detect the usb printer, and use it if it is there, but if not default to parallel.  I think the system can detect a usb printer, but i'm not sure about parallel.  

to detect the usb, i'd do something like this...

#!/bin/bash
usb=`lsusb -v | grep USBPRINTERSTRING | wc -l`
if [[$usb = "1"]]
then
lpoptions -d USBLaser
else
lpoptions -d ParaLaser
fi
0
 
NTNBowerAuthor Commented:
I was just working on a script to do that same thing before I left work on Friday! I am plannig to set this up for on a few "known to work" low end printers, so I would think this should work most of the time. So I am guessing there is nothing to check for a parallel?

0
 
edkim80Commented:
unfortunately, i do not have access to a parallel printer, so maybe someone else can comment on this...
'lpstat' may give you information on what printers are connected?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.