source: branches/samba-3.3.x/examples/scripts/printing/cups/smbaddprinter.pl

Last change on this file was 206, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 1.4 KB
Line 
1#!/usr/bin/perl
2## Add printer script for samba, APW, and cups
3## Copyright (C) Jeff Hardy <hardyjm@potsdam.edu> 2004
4##
5## This program is free software; you can redistribute it
6## and/or modify it under the terms of the GNU General
7## Public License as published by the Free Software Foundation;
8## Either version 3 of the License, or (at your option) any
9## later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public
17## License along with this program; if not, see <http://www.gnu.org/licenses/>.
18
19@argv = @ARGV;
20
21# take in args
22my $lpname=shift(@argv); # printer name
23my $shname=shift(@argv); # share name -> used for CUPS queue name
24my $portname=shift(@argv); # port name
25my $drivername=shift(@argv); # driver name -> used for CUPS description
26my $location=shift(@argv); # location -> used for CUPS device URI
27my $win9x=shift(@argv); # win9x location
28
29#check for location syntax
30#if no protocol specified...
31if ($location !~ m#:/#){
32 #assume an lpd printer
33 $location = "lpd://".$location;
34}
35#else, simply pass the URI on to the lpadmin command
36
37#run the cups lpadmin command to add the printer
38system("/usr/sbin/lpadmin -p $shname -D \"$drivername\" -E -v $location");
39
Note: See TracBrowser for help on using the repository browser.