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

Paul pconklin at gentlemanslife.com
Tue Oct 19 16:46:39 PDT 2010


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!








More information about the cups mailing list