Subject: Printing under Solaris

From: rnf <[email-masked]>
Date: Tue, 12 Feb 2002 20:55:05 -0500 (EST)

Hi Admins,

I have netatalk-1.4b2+asun2.1.4 installed on a Solaris 8 machine and I'm able to 
print a PostScript file using pap but I'm having no luck getting lp to filter a 
print job and submit it to pap as PostScript.

Can anyone point me to some documentation on how to set this up?  The FAQ's 
don't cover if for Solaris.

There used to be a good web site that discussed this, but it has disappeared 
(should have copied that info locally).

Thanks!

Rick
[email-masked]

---

From: Sak Wathanasin <[email-masked]>
Date: Wed, 13 Feb 2002 13:10:23 +0000

In reply to rnf's message of the 12/02/2002 at 20:55 -0500,

>don't cover if for Solaris.

I got the following from somewhere a long time ago; can't remember 
where or who wrote them originally. One is a filter to be used as a 
"model" for lp; th eother is a script that installs a new printer 
into the lp system. You will need to modilfy them to suit your 
environment:

First the script; save this as "add_at_printer.sh" or some such:
---
#!/bin/sh

ATALKHOME=/usr/local

ATPRINTER=$1
UXPRINTER=$2

if [ ! -r /etc/lp/filter.table ]; then
	echo "Initializing of default printer filters..."
	for f in `ls /etc/lp/fd | sed 's/.fd$//'`; do
		lpfilter -f $f -F/etc/lp/fd/$f.fd
	done
fi

if lpfilter -f atalk -l > /dev/null 2>&1; then
	echo "AppleTalk printer filter is already defined."
else
	echo "Defining AppleTalk printer filter ..."
	cat > /etc/lp/fd/atalk.fd << EOF

Input types: postscript
Output types: PS
Printer types: AppleTalk
Printers: any
Filter type: slow
Command: /usr/bin/cat
EOF
	lpfilter -f atalk -F /etc/lp/fd/atalk.fd
fi

if [ ! -f /usr/share/lib/terminfo/A/AppleTalk ]; then
	echo "Defining terminfo for AppleTalk printers ..."
	cat > /var/tmp/terminfo << EOF
AppleTalk,
	cols#80, lines#66,
	cpi=null, csnm=^D, lpi=null, scs=^D, slines=^D, u9=^D,
EOF
	tic /var/tmp/terminfo
         rm /var/tmp/terminfo
fi

LOCKSDIR=/var/spool/lp/tmp/AppleTalk
if [ ! -d $LOCKSDIR ]; then
	mkdir -m 0771	$LOCKSDIR
	chown lp	$LOCKSDIR
	chgrp lp	$LOCKSDIR
fi
PSEUDODEVICE=$LOCKSDIR/$UXPRINTER
touch		$PSEUDODEVICE
chown lp	$PSEUDODEVICE
chgrp lp	$PSEUDODEVICE
chmod 0600	$PSEUDODEVICE

echo "(Re)defining $UXPRINTER ..."
(	lpadmin -p $UXPRINTER -D "$UXPRINTER" \
		-T AppleTalk \
		-v $PSEUDODEVICE \
		-I PS \
		-i $ATALKHOME/etc/lp2pap.sh \
		-o nobanner \
		-A mail && \
         echo $ATPRINTER > /etc/lp/printers/$UXPRINTER/.paprc
         #echo $ATPRINTER > /var/spool/lp/tmp/cu/.paprc
         chown lp /etc/lp/printers/$UXPRINTER/.paprc
         chgrp lp /etc/lp/printers/$UXPRINTER/.paprc
         #chown lp /var/spool/lp/tmp/cu/.paprc
         #chgrp lp /var/spool/lp/tmp/cu/.paprc
	accept $UXPRINTER && \
	enable $UXPRINTER \
) || exit

---

Next the filter:
---save as "appletalk" or similar---
#
# Change APPLETALK_PRINTER to match your printer's appletalk name
# If you don't know the name, use /opt/atalk/bin/nbplkup | grep Laser
#
APPLETALK_PRINTER='Tech support:LaserWriter'
PRINTER_NAME='tech_support'

#################################################################
#!/usr/bin/sh
# LP job parameters
job=$1
user1=$2
user=`echo $2 | line | cut -d! -f2`
sysname=`echo $2 | line | cut -d! -f1`
title=$3
copy=$4
options=$5
shift 5
files="$*"
logfile='/tmp/$PRINTER_NAME.log'
if [ ! -f $logfile ]; then
	touch $logfile
	chmod a+w $logfile
fi
#
# The next line may need to be changed so that the pap executable
# is found on your system.
#
/usr/local/atalk/bin/pap -p "$APPLETALK_PRINTER"  $files  2>&1 >> $logfile
#
exit 0
---

The way to use them is to do

sh add_at_printer appletalk lw

where param 1 is the "model" script and param2 is whatever you wnat 
to call th eprinter in the Unix system.

If anyone can remember who wrote these or where they came from 
perhaps it could be added to the FAQ (there used to be a link from 
the netatalk home page...).

-- 
Sak Wathanasin
Network Analysis Limited           http://www.network-analysis.ltd.uk

Phone: (+44) 24 76 41 99 96     Mobile: (+44) 79 70 75 19 12 
Fax: (+44) 24 76 69 06 90

---

From: Thomas Kaiser <[email-masked]>
Date: Wed, 13 Feb 2002 14:32:55 +0100

> If anyone can remember who wrote these or where they came from

A quick google search let me believe, that the scripts have been supplied
with CAP:

    <http://www.cit.uws.edu.au/pub/unix/misc/appletalk/cap60.patch194>,
    <http://www.netsys.com/sunmgr/1997-04/msg00026.html>

and modified for use with Netatalk:

    <http://www.umich.edu/~rsug/netatalk/archive/admins/1998/0867.html>

Regards,

Thomas