diff options
Diffstat (limited to 'cups-pdf.postprocessing.sh')
-rwxr-xr-x | cups-pdf.postprocessing.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cups-pdf.postprocessing.sh b/cups-pdf.postprocessing.sh new file mode 100755 index 0000000..9c6b2dd --- /dev/null +++ b/cups-pdf.postprocessing.sh | |||
@@ -0,0 +1,40 @@ | |||
1 | #!/bin/sh | ||
2 | : This script allows a shared network PDF printer to be | ||
3 | : used to send documents to the default printer. | ||
4 | : That way, clients do not need to install the | ||
5 | : printer-specific driver that would be needed if the | ||
6 | : default printer were shared directly. Only the standard | ||
7 | : cups PDF printer driver is needed. | ||
8 | |||
9 | : To use: | ||
10 | : | ||
11 | : 1. Copy this file to '/etc/cups/cups-pdf.postprocessing.sh' | ||
12 | : | ||
13 | : 2. Add the following line to '/etc/cups/cups-pdf.conf' : \ | ||
14 | PostProcessing /etc/cups/cups-pdf.postprocessing.sh | ||
15 | : | ||
16 | : 3. Run 'systemctl restart cups' | ||
17 | : | ||
18 | |||
19 | LOGFILE=/tmp/$0.$$.log | ||
20 | LOGFILE= | ||
21 | |||
22 | if [ "$LOGFILE" ] | ||
23 | then | ||
24 | exec >>"$LOGFILE" 2>&1 | ||
25 | fi | ||
26 | |||
27 | set -ex | ||
28 | |||
29 | : progname "$0" args "$*" | ||
30 | |||
31 | [ "$2" = nobody ] || exit 0 | ||
32 | |||
33 | default_printer=$(env - lpstat -d) | ||
34 | default_printer=${default_printer##* } | ||
35 | |||
36 | [ "$default_printer" ] | ||
37 | [ "$PRINTER_INFO" ] | ||
38 | [ "$PRINTER_INFO" != "$default_printer" ] | ||
39 | |||
40 | env - lp -d "$default_printer" "$1" | ||