Cups Package Lpget Wrapper
Example script snippet: wrapper for lpget
This is an example script which emulates lpget for the cups printing system.
#!/bin/bash
#
# See: http://www.mozdev.org/pipermail/xprint/2003-October/000063.html
#
# Required for CSWcupsclient. Solaris 10 Xprt makes hardcoded calls to
# lpget in order to provide a printers list (as does OpenOffice). Ideally
# lpget returns
#
# printername\tdescription
#
# when given a printername, but i haven't found a way to get the
# descriptions via the cups client tools, so for now the description
# is left blank
#
# Some regular lpget output for reference purposes:
#
# # lpget -k description valdez
# valdez:
# description - undefined
#
# # lpget list
# valdez:
# printer-uri-supported=ipp://ray2/printers/valdez
# bsdaddr=ray2,valdez,Solaris
# bismarck:
# bsdaddr=hwsrv.int.consol.de,bismarck,hp
# _default:
# use=valdez
# tt:
# printer-uri-supported=ipp://printsrv.example.com:631/printers/bismarck_simplex_test
# bsdaddr=printsrv.example.com:631,bismarck_simplex_test,Solaris
#
[ $# -gt 0 ] || exit 1
printserver=printsrv.example.com
# soffice requests a list of all printers
if [ "$1" == "list" ]; then
/opt/csw/bin/lpstat -a | grep accept | cut -d" " -f1 | while read p
do
cat <<EOM
$p:
printer-uri-supported=ipp://$printserver:631/printers/$p
bsdaddr=$printserver:631,$p
EOM
done
fi
# otherwise just print a single printer description
PRINTER=$( echo $* | awk '{ print $NF }' )
cat <<EOM
$PRINTER:
description - undefined
EOM
page revision: 0, last edited: 27 Feb 2010 09:07