Cups Filter...How do I get out of $TMPDIR and back to $6

Helge Blischke h.blischke at acm.org
Wed Oct 20 02:53:38 PDT 2010


Paul wrote:

> I have a need to insert a charecter at the beginning of a raw job (fully
> encapsulated Zebra ZPL Code)  So I thought the best way would be to use
> the generic text PPD and make my own script based filter.  this is the
> only line i modified in the generic text PPD
> 
> *cupsFilter:    "text/plain 0 rawzplrv"
> 
> I then created my rawzplrv filter as well as conv file
> 
> conv
> text/plain application/vnd.cups-raw 0 rawzplrv
> 
> rawzplrv filter
> #!/bin/sh
> echo "insert text here" >> $TMPDIR/$$.zpl
> cat $6 >> $TMPDIR/$$.zpl
> cat $TMPDIR/$$.zpl > $6
> (purposely left off rm so I can debug)
> 
> My problem is this, it properly generates the file in the $TMPDIR but i
> can't get that info out to the spool file ($6)
> 
> D [19/Oct/2010:17:42:57 -0500] [Job 413] /usr/lib/cups/filter/rawzplrv:
> line 4: /var/spool/cups/d00415-001: Permission denied
> 
> or when I try a move
> 
> D [19/Oct/2010:17:38:11 -0500] [Job 412] mv: cannot move
> `/var/spool/cups/tmp/19060.zpl' to `/var/spool/cups/d00415-001':
> Permission denied
> 
> /var/spool/cups/tmp>
> # ls -l
> total 8
> -rw------- 1 lp lp  240 Oct 19 18:36 19060.zpl
> 
> /var/spool/cups>
> # ls -l d*
> -rw-r----- 1 root lp 229 Oct 19 18:36 d00415-001
> 
> I know it's because of permissions because the spool file is owned by
> root, but how do i get around this?  looking at some of the other script
> based filters, they execute a program and use $6 as the output.  I've
> scowered the net and books, any help greatly appreciated!

Why don't you stick to the CUPS filter conventions as to write all the final 
output to stdout?
As you force your filter (by the PPD statement) to be the very last one 
before the backend, there is no need to write the data back to the spool 
directory.

Helge





More information about the cups mailing list