]>
Commit | Line | Data |
---|---|---|
a79a4d11 | 1 | --- samba-pre2.0.7/packaging/RedHat/smbprint.foo Mon Nov 16 13:44:11 1998 |
2 | +++ samba-pre2.0.7/packaging/RedHat/smbprint Tue Feb 1 23:04:21 2000 | |
3 | @@ -1,5 +1,4 @@ | |
4 | #!/bin/sh | |
5 | - | |
6 | # This script is an input filter for printcap printing on a unix machine. It | |
7 | # uses the smbclient program to print the file to the specified smb-based | |
8 | # server and service. | |
9 | @@ -18,7 +17,7 @@ | |
10 | # | |
11 | # Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton) | |
12 | # so that the server, service, and password can be read from | |
13 | -# a /var/spool/lpd/PRINTNAME/.config file. | |
14 | +# a /usr/var/spool/lpd/PRINTNAME/.config file. | |
15 | # | |
16 | # In order for this to work the /etc/printcap entry must include an | |
17 | # accounting file (af=...): | |
18 | @@ -32,46 +31,54 @@ | |
19 | # :lp=/dev/null: | |
20 | # | |
21 | # The /usr/var/spool/lpd/PRINTNAME/.config file should contain: | |
22 | -# server=PC_SERVER | |
23 | -# service=PR_SHARENAME | |
24 | +# share=PC_SERVER | |
25 | +# user="user" | |
26 | # password="password" | |
27 | # | |
28 | -# E.g. | |
29 | -# server=PAULS_PC | |
30 | -# service=CJET_371 | |
31 | +# Please, do not modify the order in the file. | |
32 | +# Example: | |
33 | +# share=\\server\deskjet | |
34 | +# user="fred" | |
35 | # password="" | |
36 | ||
37 | # | |
38 | -# Debugging log file, change to /dev/null if you like. | |
39 | -# | |
40 | -# logfile=/tmp/smb-print.log | |
41 | -logfile=/dev/null | |
42 | - | |
43 | - | |
44 | -# | |
45 | # The last parameter to the filter is the accounting file name. | |
46 | # Extract the directory name from the file name. | |
47 | # Concat this with /.config to get the config file. | |
48 | # | |
49 | -eval acct_file=\${$#} | |
50 | +eval acct_file=\$$# | |
51 | spool_dir=`dirname $acct_file` | |
52 | config_file=$spool_dir/.config | |
53 | ||
54 | # Should read the following variables set in the config file: | |
55 | -# server | |
56 | -# service | |
57 | +# share | |
58 | +# hostip | |
59 | +# user | |
60 | # password | |
61 | + | |
62 | eval `cat $config_file` | |
63 | ||
64 | -# | |
65 | -# Some debugging help, change the >> to > if you want to same space. | |
66 | -# | |
67 | -echo "server $server, service $service" >> $logfile | |
68 | +share=`echo $share | sed "s/[\]/\//g"` | |
69 | ||
70 | -( | |
71 | -# NOTE You may wish to add the line `echo translate' if you want automatic | |
72 | -# CR/LF translation when printing. | |
73 | -# echo translate | |
74 | - echo "print -" | |
75 | - cat | |
76 | -) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P >> $logfile | |
77 | +if [ "$user" != "" ]; then | |
78 | + usercmd="-U" | |
79 | +else | |
80 | + usercmd="" | |
81 | +fi | |
82 | + | |
83 | +if [ "$workgroup" != "" ]; then | |
84 | + workgroupcmd="-W" | |
85 | +else | |
86 | + workgroupcmd="" | |
87 | +fi | |
88 | + | |
89 | +if [ "$translate" = "yes" ]; then | |
90 | + command="translate ; print -" | |
91 | +else | |
92 | + command="print -" | |
93 | +fi | |
94 | +#echo $share $password $translate $x_command > /tmp/smbprint.log | |
95 | + | |
96 | +cat | /usr/bin/smbclient "$share" "$password" -E ${hostip:+-I} \ | |
97 | + $hostip -N -P $usercmd "$user" $workgroupcmd "$workgroup" \ | |
98 | + -c "$command" 2>/dev/null |