> From [EMAIL PROTECTED] Thu Apr  4 15:22:21 2002
> Date: Fri, 5 Apr 2002 08:44:00 +1000
> To: [EMAIL PROTECTED]
> Subject: Re: LPRng: Simple Samba
> From: [EMAIL PROTECTED] (Craig Small)
>
> On Thu, Apr 04, 2002 at 02:46:59PM -0500, Jeff Baldwin wrote:
> > What pakcages are required for me to setup printing using LPRng.  I want 
> > to keep the install as small as possible, but I want to make sure that I 
> > don't lack functionality..
> > 
> > Are there any packages other than LPRng that I should gather?
>
> You may possibly want to put some printing filters on their but usually
> for windows printing this is not needed (and causes more problems
> sometimes).  Other than that, samba+lprng are about all you need.
>
> If you want to go the other way (Unix lpr/lpd to SMB printer) be careful
> of one thing.  The method given in the LPRng howto used to work with
> old smbprints and sometimes works with the new smbprint.
>
> The nice samba people have given us the -c flag which is a very welcome
> addition.  Change the last few lines to:
>
> cat | /usr/bin/smbclient "\\\\$server\\$service" \
>        "$password" -U "$server" -c "print -" -N -P 1>&2
>
> It gets rid of that awful echo rubbish you had to have.  That's good
> when wierd things happen as the script sometimes used to hang.
>
>   - Craig
> -- 
> Craig Small VK2XLZ  GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
> Eye-Net Consulting http://www.eye-net.com.au/        <[EMAIL PROTECTED]>
> MIEEE <[EMAIL PROTECTED]>                 Debian developer <[EMAIL PROTECTED]>

You can, of course, use the smbprint in the LPRng-3.8.9++/UTILS directory.
It 'autodetects' which version of smbclient you have and will use
the appropriate command.... Here it is... (Note the attributions).

#!/bin/sh
#
# Blatently lifted from some folks who blatently lifted it from
# other folks,  who seem to have taken it from one of the very
# first Samba distributions.
#  Patrick ("Worse than a chain letter") Powell
#
# This script supports sending a print job to an SMB (Samba/Microsoft)
# printer using the 'smbclient' from the Samba distribution.
#
# Variation 1: LPRng + smbclient -A auth
#  smb:lp=|/.../smbprint
#   :sd=/var/spool/lpd/%P
#   :xfer_options=share=//host/share authfile=auth
#    - user name and password in /var/spool/lpd/smb/auth file 
#    - requires version of smbclient that uses -A authfile
# Variation 2: LPRng + smbclient -U username password
#  smb:lp=|/.../smbprint
#   :sd=/var/spool/lpd/%P
#   :xfer_options=share=//host/share authfile=auth
#    - user name and password in /var/spool/lpd/smb/auth file 
#    - requires version of smbclient that uses -A authfile
# Variation 3: LPRng + used as filter
#  smb:lp=/dev/null
#   :if=/.../smbprint
#   :sd=/var/spool/lpd/%P
#   :xfer_options=share=//host/share authfile=auth
#    - user name and password in /var/spool/lpd/smb/auth file 
# Variation 4: pass options in $spooldir/general.cfg file
#  smb:lp=/dev/null OR lp=|/.../smbprint OR :if=/.../smbprint
#    - options in /var/spool/lpd/smb/general.cfg file 
#
#  The general.cfg file is used to set shell variables
#
#   share=//host/share   - share (required)
#   hostip=              - host ip address (optional)
#   workgroup=           - workgroup (required)
#   authfile=auth        - authorization file (optional)
#   translate=           - do translation (optional and DANGEROUS)
#
# The authentication file (authfile) holds the username and
# password value.  You can put these in the general.cfg file
# as well.  WARNING: smbclient requires the authentication file
# to have the format:
#     username=name
#     password=xxxx
# There are NO quotes allowed around the name and/or password
# files so the password value xxxx must not contain shell
# quote or metacharacters.
# 

PATH=/bin:/usr/bin:/usr/local/bin
export PATH


# get options from  general.cfg file
if [ -f ./general.cfg ] ; then
        source ./general.cfg
fi

# get options from $PRINTCAP_ENTRY environment variable
options=`echo "${PRINTCAP_ENTRY}" | sed -n 's/:xfer_options=//p' `
echo OPTIONS $options >&2
if [ -n "$options" ] ; then
        eval export $options
fi

# a brutal way to determine if smbclient takes the -A authfile option
smbclientold=`smbclient -A /dev/null 2>&1 </dev/null | grep 'invalid option'`

# check for smbclientold=yes and fix up authfile/password stuff
if [ "$smbclientold" != "" -a "$authfile" != "" -a -f "$authfile" ] ; then
        . $authfile
        authfile=
fi

if [ "$translate" = "yes" ]; then
 command="translate ; print -"
else
 command="print -"
fi

#echo $share $password $translate $x_command > /tmp/smbprint.log

# use the -A or 
if [ "$smbclientold" = "" ] ; then
#       echo smbclient "$share" ${password:+password} -E \
#       ${username:+-U} ${username:+username} ${hostip:+-I} $hostip -N 
${workgroup:+-W} $workgroup \
#     ${authfile:+-A} $authfile -c "$command" >&2
        smbclient "$share" ${password} -E \
        ${username:+-U} ${username} ${hostip:+-I} $hostip -N ${workgroup:+-W} 
$workgroup \
     ${authfile:+-A} $authfile -c "$command" >&2
else
#       echo echo \"$command\" "|" smbclient "$share" ${password:+password} -E \
#       ${username:+-U} ${username:+username} ${hostip:+-I} $hostip -N 
${workgroup:+-W} $workgroup \
#               >&2
        echo $command | smbclient "$share" ${password} -E \
        ${username:+-U} ${username} ${hostip:+-I} $hostip -N ${workgroup:+-W} 
$workgroup \
                >&2
fi

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to