The Samba-Bugzilla – Attachment 1350 Details for
Bug 2950
Problems in adding printers using add printer script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
The "addprinter command" script
addprinter.pl (text/plain), 2.26 KB, created by
Guruswamy
on 2005-08-02 08:24:56 UTC
(
hide
)
Description:
The "addprinter command" script
Filename:
MIME Type:
Creator:
Guruswamy
Created:
2005-08-02 08:24:56 UTC
Size:
2.26 KB
patch
obsolete
>#! /usr/bin/perl >#Script to Add/modify printers. Makes use of lpadmin >#-------------------------------------------------------------------- ># Parameters given by the APW: ># $1 = printer name ># $2 = share name ># $3 = port name ># $4 = driver name ># $5 = location ># $6 = windows 9x driver location >#-------------------------------------------------------------------- > >$smb_pr_dir="/state/samba/printers"; >$addpr_log="$smb_pr_dir/addprinter.log"; >($printername,$sharename,$portname,$drivername,$location,$driverlocation) = @ARGV; > >if(!open(LOG,">>$addpr_log")) { > die "Unable to open the log file $addpr_log"; >} >if($sharename eq "") { > $sharename=$printername; >} >if($location eq "") { > $location="default"; >} >if($portname eq "") { > $portname="Samba Printer Port"; >} > >print LOG "\nPrinter:",$printername,"\nShare:",$sharename,"\nPort:",$portname,"\nDriver:",$drivername,"\nLocation:",$location,"\nDriverloc:",$driverlocation,"\n"; >$printersfile='/etc/cups/printers.conf'; > >if (!open (PRINTERS,"<$printersfile")) { > die "can't open $printersfile"; >} > >@lines = <PRINTERS>; >foreach $eachline(@lines) { > if($eachline =~ /<Printer/ || $eachline =~ /<DefaultPrinter/) { > @temp = split(" ",$eachline); > $currentprinter = @temp[1];chop($currentprinter); > #print "The current printer is :", $currentprinter,"\n"; > } > if($eachline =~ /DeviceURI/ ) { > chop($eachline); > ($temp,$currURI)=split(" ",$eachline); > #print "The current URI is :",$currURI, "\n"; > > if($sharename eq $currentprinter) { > print LOG "Found the printer :",$currentprinter," and the URI is :",$currURI,"\n"; > last; > } > } >} >$print_port="Samba Printer Port"; >$driverloc=`grep -lr "$drivername" $smb_pr_dir/W32X86 | head -1`; >chop ($driverloc); >print LOG "The Driver location is :" ,$driverloc,"\n"; >if($currentprinter ne $sharename) { > print LOG "Executing command for new printer: /usr/sbin/lpadmin -p $sharename -P $driverloc -L $location -v $portname -E"; > `/usr/sbin/lpadmin -p "$sharename" -P "$driverloc" -L "$location" -v "$portname" -E`; >} >else { > print LOG "Executing command for modify printer: //usr//sbin//lpadmin -p $sharename -P $driverloc -L $location -E -v $currURI"; > `/usr/sbin/lpadmin -p "$sharename" -P "$driverloc" -L "$location" -E -v "$currURI"`; >} >close PRINTERS; >close LOG; > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2950
: 1350 |
1351
|
1352
|
1353
|
1363
|
1395