summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2002-08-01 23:26:10 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2002-08-01 23:26:10 +0000
commit84475732515cf646ae4e735b014c5bd8cf2e3ab5 (patch)
tree061964f98d14e3454212e123717d4760fb7ba0b2
parent4debb6278e650860bc8223534e5f6c4592f1f5a2 (diff)
downloaddrakx-84475732515cf646ae4e735b014c5bd8cf2e3ab5.tar
drakx-84475732515cf646ae4e735b014c5bd8cf2e3ab5.tar.gz
drakx-84475732515cf646ae4e735b014c5bd8cf2e3ab5.tar.bz2
drakx-84475732515cf646ae4e735b014c5bd8cf2e3ab5.tar.xz
drakx-84475732515cf646ae4e735b014c5bd8cf2e3ab5.zip
Added stuff for scanning network for SMB printer shares.
-rw-r--r--perl-install/printerdrake.pm22
1 files changed, 18 insertions, 4 deletions
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index bde98bd6f..773921000 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -246,6 +246,8 @@ Do you really want to get your printers auto-detected?"),
$menustr .= _(", USB printer \#%s", $1);
} elsif ($p->{port} =~ m!^socket://([^:]+):(\d+)$!) {
$menustr .= _(", network printer \"%s\", port %s", $1, $2);
+ } elsif ($p->{port} =~ m!^smb://([^/:]+)/([^/:]+)$!) {
+ $menustr .= _(", printer \"%s\" on SMB/Windows server \"%s\"", $2, $1);
}
if ($::expert) {
$menustr .= " ($p->{port})";
@@ -260,6 +262,8 @@ Do you really want to get your printers auto-detected?"),
$menustr = _("USB printer \#%s", $1);
} elsif ($p->{port} =~ m!^socket://([^:]+):(\d+)$!) {
$menustr .= _("Network printer \"%s\", port %s", $1, $2);
+ } elsif ($p->{port} =~ m!^smb://([^/:]+)/([^/:]+)$!) {
+ $menustr .= _("Printer \"%s\" on SMB/Windows server \"%s\"", $2, $1);
}
if ($::expert) {
$menustr .= " ($p->{port})";
@@ -315,8 +319,18 @@ Do you really want to get your printers auto-detected?"),
$menuentries->{$menustr} = "/dev/usb/lp$m";
}
}
- my @menuentrieslist = sort { $menuentries->{$a} cmp $menuentries->{$b} }
- keys(%{$menuentries});
+ my @menuentrieslist = sort {
+ my @prefixes = ("/dev/lp", "/dev/usb/lp", "/dev/", "socket:", "smb:");
+ my $first = $menuentries->{$a};
+ my $second = $menuentries->{$b};
+ for (my $i = 0; $i <= $#prefixes; $i++) {
+ my $firstinlist = ($first =~ m!^$prefixes[$i]!);
+ my $secondinlist = ($second =~ m!^$prefixes[$i]!);
+ if (($firstinlist) && (!$secondinlist)) {return -1};
+ if (($secondinlist) && (!$firstinlist)) {return 1};
+ }
+ return $first cmp $second;
+ } keys(%{$menuentries});
my $menuchoice = "";
my $oldmenuchoice = "";
if (($printer->{configured}{$queue}) &&
@@ -358,8 +372,8 @@ Do you really want to get your printers auto-detected?"),
}
}
} elsif (($printer->{configured}{$queue}) &&
- ($printer->{currentqueue}{connect} =~ m!^socket:/!)) {
- # Ethernet-(TCP/Socket)-connected printer
+ ($printer->{currentqueue}{connect} =~ m!^(socket|smb):/!)) {
+ # Ethernet-(TCP/Socket)-connected printer or printer on Windows server
$device = $printer->{currentqueue}{connect};
for my $p (keys %{$menuentries}) {
if ($device eq $menuentries->{$p}) {