summaryrefslogtreecommitdiff
path: root/cups-pdf.postprocessing.sh
blob: 9c6b2dd4a29f41aef22eb27135a33cf8f157ef56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
: This script allows a shared network PDF printer to be
: used to send documents to the default printer.
: That way, clients do not need to install the
: printer-specific driver that would be needed if the 
: default printer were shared directly.  Only the standard
: cups PDF printer driver is needed.

: To use:
:
: 1. Copy this file to '/etc/cups/cups-pdf.postprocessing.sh'
:
: 2. Add the following line to '/etc/cups/cups-pdf.conf' : \
PostProcessing /etc/cups/cups-pdf.postprocessing.sh
:
: 3. Run 'systemctl restart cups'
:

LOGFILE=/tmp/$0.$$.log
LOGFILE=

if [ "$LOGFILE" ]
then
	exec >>"$LOGFILE" 2>&1
fi

set -ex

: progname "$0" args "$*"

[ "$2" = nobody ] || exit 0

default_printer=$(env - lpstat -d)
default_printer=${default_printer##* }

[ "$default_printer" ]
[ "$PRINTER_INFO" ]
[ "$PRINTER_INFO" != "$default_printer" ]

env - lp -d "$default_printer" "$1"