source: trunk/debathena/debathena/pharos-support/pharos @ 25383

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