Revision 25383,
1.1 KB
checked in by jdreed, 13 years ago
(diff) |
In pharos-support:
* First version
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[25383] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # Usage: $0 [job_id] [username] [title] [copies] [options] [filename] |
---|
| 4 | # |
---|
| 5 | # Exit codes: 0 - Success |
---|
| 6 | # 1 - Failed |
---|
| 7 | # 2 - Auth required |
---|
| 8 | # 3 - Hold (try again later) |
---|
| 9 | # 4 - Stop (don't retry) |
---|
| 10 | # 5 - Cancel (cancel job and remove from queue |
---|
| 11 | |
---|
| 12 | discovery() { |
---|
| 13 | printf "%s %s \"%s\" \"%s\"\n" network pharos Unknown "MIT Pharos Printer" |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | usage() { |
---|
| 17 | echo "$0 job-id username title copies options [filename]" |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | case $# in |
---|
| 21 | 0) |
---|
| 22 | discovery && exit 0 |
---|
| 23 | ;; |
---|
| 24 | 5|6) |
---|
| 25 | ;; |
---|
| 26 | *) |
---|
| 27 | usage && exit 1 |
---|
| 28 | ;; |
---|
| 29 | esac |
---|
| 30 | |
---|
| 31 | # I wonder if this works for Jerry Saltzer? |
---|
| 32 | DEVICE_URI="$(echo $DEVICE_URI | tr 'A-Z' 'a-z' | sed -e 's|^pharos://||')" |
---|
| 33 | PHAROS_QUEUE="$(echo $DEVICE_URI | awk -F/ '{print $1}')" |
---|
| 34 | case "$PHAROS_QUEUE" in |
---|
| 35 | bw|color) |
---|
| 36 | ;; |
---|
| 37 | *) |
---|
| 38 | # Unknown Printer |
---|
| 39 | exit 4 #CUPS_BACKEND_STOP |
---|
| 40 | ;; |
---|
| 41 | esac |
---|
| 42 | USERNAME="$(echo $DEVICE_URI | awk -F/ '{print $2}')" |
---|
| 43 | # Should we test for [A-Za-z] instead? |
---|
| 44 | if [ -z "$USERNAME" ]; then |
---|
| 45 | USERNAME="$2" |
---|
| 46 | fi |
---|
| 47 | JOBID="$1" |
---|
| 48 | shift 2 |
---|
| 49 | export DEVICE_URI="lpd://mitprint.mit.edu/${PHAROS_QUEUE}" |
---|
| 50 | exec /usr/lib/cups/backend/lpd "$JOBID" "$USERNAME" "$@" |
---|
| 51 | |
---|
Note: See
TracBrowser
for help on using the repository browser.