1997-09-05 06:28:41 +04:00
#!/bin/sh
#
# @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin@march.co.uk>
#
# Version 1.0 13 January 1995
# modified from the original smbprint (bsd) script
#
1998-05-14 23:04:29 +04:00
# this script is a System 5 printer interface script. It uses the smbclient
# program to print the file to the specified smb-based server and service.
1997-09-05 06:28:41 +04:00
#
1998-05-14 23:04:29 +04:00
# To add this to your lp system, modify the server and service variables
# and then execute the following command (as root):
1997-09-05 06:28:41 +04:00
#
1998-05-14 23:04:29 +04:00
# lpadmin -punixprintername -v/dev/null -i/usr/samba/bin/smbprint
1997-09-05 06:28:41 +04:00
#
# where unixprintername is the name that the printer will be known as
# on your unix box.
#
# the script smbprint will be copied into your printer administration
1998-05-14 23:04:29 +04:00
# directory (/usr/spool/lp) as a new interface (interface/unixprintername)
# Then you have to execute the following commands:
1997-09-05 06:28:41 +04:00
#
1998-05-14 23:04:29 +04:00
# enable unixprintername
# accept unixprintername
#
# This script will then be called by the lp service to print the files.
1997-09-05 06:28:41 +04:00
# This script will have 6 or more parameters passed to it by the lp service.
# The first five will contain details of the print job, who queued it etc,
# while parameters 6 onwards are a list of files to print. We just
1998-05-14 23:04:29 +04:00
# cat these to the samba client.
1997-09-05 06:28:41 +04:00
#
# clear out the unwanted parameters
1998-05-14 23:04:29 +04:00
1997-09-05 06:28:41 +04:00
shift;shift;shift;shift;shift
1998-05-14 23:04:29 +04:00
1997-09-05 06:28:41 +04:00
# now the argument list is just the files to print
1998-05-14 23:04:29 +04:00
# Set these to the server and service you wish to print to
# In this example I have a PC called "admin" that has a printer
# exported called "hplj2" with no password.
#
1997-09-05 06:28:41 +04:00
server=admin
service=hplj2
password=""
1998-05-14 23:04:29 +04:00
# NOTE: The line `echo translate' provides automatic CR/LF translation
# when printing.
1997-09-05 06:28:41 +04:00
(
1998-05-14 23:04:29 +04:00
echo translate
1997-09-05 06:28:41 +04:00
echo "print -"
cat $*
2001-06-01 16:33:16 +04:00
) | /usr/samba/bin/smbclient "//$server/$service" $password -N > /dev/null
1997-09-05 06:28:41 +04:00
exit $?