From e74e0b235c3dc544e04464e5dba8cfddbc8c5fd1 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Mon, 26 Aug 2002 13:04:26 +0000 Subject: A small type and addition of an example add printer command script. (This used to be commit 7c5f94e73746fcb97e440a29e5abc7bbb0a6c250) --- docs/docbook/projdoc/printer_driver2.sgml | 56 ++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/docbook/projdoc/printer_driver2.sgml b/docs/docbook/projdoc/printer_driver2.sgml index 8146ae5616..85ae0713b3 100644 --- a/docs/docbook/projdoc/printer_driver2.sgml +++ b/docs/docbook/projdoc/printer_driver2.sgml @@ -382,11 +382,65 @@ of the connected user, not necessarily a root account. -There is a complementing delete +There is a complementary delete printer command for removing entries from the "Printers..." folder. + +The following is an example add printer command script. It adds the appropriate entries to /etc/printcap.local (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work. + + + +#!/bin/sh + +# Script to insert a new printer entry into printcap.local +# +# $1, printer name, used as the descriptive name +# $2, share name, used as the printer name for Linux +# $3, port name +# $4, driver name +# $5, location, used for the device file of the printer +# $6, win9x location + +# +# Make sure we use the location that RedHat uses for local printer defs +PRINTCAP=/etc/printcap.local +DATE=`date +%Y%m%d-%H%M%S` +LP=lp +RESTART="service lpd restart" + +# Keep a copy +cp $PRINTCAP $PRINTCAP.$DATE +# Add the printer to $PRINTCAP +echo "" >> $PRINTCAP +echo "$2|$1:\\" >> $PRINTCAP +echo " :sd=/var/spool/lpd/$2:\\" >> $PRINTCAP +echo " :mx=0:ml=0:sh:\\" >> $PRINTCAP +echo " :lp=/usr/local/samba/var/print/$5.prn:" >> $PRINTCAP + +touch "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1 +chown $LP "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1 + +mkdir /var/spool/lpd/$2 +chmod 700 /var/spool/lpd/$2 +chown $LP /var/spool/lpd/$2 +#echo $1 >> "/usr/local/samba/var/print/$5.prn" +#echo $2 >> "/usr/local/samba/var/print/$5.prn" +#echo $3 >> "/usr/local/samba/var/print/$5.prn" +#echo $4 >> "/usr/local/samba/var/print/$5.prn" +#echo $5 >> "/usr/local/samba/var/print/$5.prn" +#echo $6 >> "/usr/local/samba/var/print/$5.prn" +$RESTART >> "/usr/local/samba/var/print/$5.prn" +# Not sure if this is needed +touch /usr/local/samba/lib/smb.conf +# +# You need to return a value, but I am not sure what it means. +# +echo "Done" +exit 0 + + -- cgit