summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-09-05 17:27:21 +0000
committerFrancois Pons <fpons@mandriva.com>2000-09-05 17:27:21 +0000
commitd64b6f87d1421b55779b24944c40b7e5df519b73 (patch)
tree89579a3bf81af8b56e700346936b9ef19d17a6e3
parenta1c87ddf72bd3657d680940da5786e3a6cc84b08 (diff)
downloaddrakx-backup-do-not-use-d64b6f87d1421b55779b24944c40b7e5df519b73.tar
drakx-backup-do-not-use-d64b6f87d1421b55779b24944c40b7e5df519b73.tar.gz
drakx-backup-do-not-use-d64b6f87d1421b55779b24944c40b7e5df519b73.tar.bz2
drakx-backup-do-not-use-d64b6f87d1421b55779b24944c40b7e5df519b73.tar.xz
drakx-backup-do-not-use-d64b6f87d1421b55779b24944c40b7e5df519b73.zip
*** empty log message ***
-rw-r--r--perl-install/ChangeLog6
-rw-r--r--perl-install/install_steps_interactive.pm4
-rw-r--r--perl-install/printer.pm15
-rw-r--r--perl-install/printerdrake.pm90
4 files changed, 63 insertions, 52 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 905162589..41b0bfb07 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-05 François Pons <fpons@mandrakesoft.com>
+
+ * printerdrake.pm: removed all previous URI specific mode and
+ added socket and expert URI general mode.
+ * printer.pm: fixed bugs, start lo interface before cups.
+
2000-09-04 François Pons <fpons@mandrakesoft.com>
* printerdrake.pm: added pnm2ppa and lm110 support in cups
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index b28942087..12da4cb5c 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -573,8 +573,8 @@ sub configurePrinter {
#- figure out what printing system to use, currently are suported cups and lpr,
#- in case this has not be detected above.
- $::beginner and $o->{printer}{mode} ||= 'cups'; #'lpr';
- if (!$o->{printer}{mode}) {
+ $::beginner and $o->{printer}{mode} ||= 'cups';
+ if ($::expert || !$o->{printer}{mode}) {
$o->{printer}{mode} = $o->ask_from_list_([''], _("What printing system do you want to use?"),
[ 'cups', 'lpr', __("Cancel") ],
);
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 4338afed8..6bb78c031 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -17,11 +17,11 @@ my $PRINTER_FILTER_DIR = "/usr/lib/rhs/rhs-printfilters";
%printer_type = (
__("Local printer") => "LOCAL",
- __("Remote lpd") => "REMOTE",
+ __("Network priner (lpd)") => "REMOTE",
__("SMB/Windows 95/98/NT") => "SMB",
__("NetWare") => "NCP",
- __("URI for Local printer") => "URI_LOCAL",
- __("URI for Network printer") => "URI_NET",
+ __("Socket") => "SOCKET",
+ __("Printer Device URI") => "URI",
);
%printer_type_inv = reverse %printer_type;
@@ -41,10 +41,10 @@ sub set_prefix($) { $prefix = $_[0]; }
sub default_queue($) { (split '\|', $_[0]{QUEUE})[0] }
sub default_spooldir($) { "/var/spool/lpd/" . default_queue($_[0]) }
-sub default_printer_type($) { ($_[0]{mode} eq /cups/ && "URI_") . "LOCAL" }
+sub default_printer_type($) { "LOCAL" }
sub printer_type($) {
for ($_[0]{mode}) {
- /cups/ && return @printer_type_inv{qw(URI_LOCAL URI_NET REMOTE SMB)};
+ /cups/ && return @printer_type_inv{qw(LOCAL REMOTE SMB SOCKET), $::expert ? qw(URI) : ()};
/lpr/ && return @printer_type_inv{qw(LOCAL REMOTE SMB NCP)};
}
}
@@ -363,6 +363,7 @@ sub poll_ppd_base {
#- the file /etc/cups/ppds.dat is no more modified.
#- if cups continue to modify it (because it reads the ppd files available), the
#- poll_ppd_base program simply cores :-)
+ run_program::rooted($prefix, "ifup lo"); #- else cups will not be happy!
run_program::rooted($prefix, "/etc/rc.d/init.d/cups start");
foreach (1..10) {
@@ -376,6 +377,10 @@ sub poll_ppd_base {
scalar(keys %descr_to_ppd) > 5 and last;
sleep 1; #- we have to try again running the program, wait here a little before.
}
+ #- just in case, poll_ppd_base may produce core if not connected immediately.
+ unlink "$prefix/core";
+
+ scalar(keys %descr_to_ppd) > 5 or die "unable to connect to cups server";
}
#-******************************************************************************
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index ddc3ba945..065e7c1a3 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -17,7 +17,7 @@ sub auto_detect {
my ($in) = @_;
{
my $w = $in->wait_message(_("Test ports"), _("Detecting devices..."));
- modules::get_alias("usb-interface") and eval { modules::load("printer"); sleep(1); };
+ modules::get_alias("usb-interface") and eval { modules::load("printer"); sleep(2); };
eval { modules::load_multi("parport_pc", "parport_probe", "lp"); };
}
my $b = before_leaving { eval { modules::unload("parport_probe") } };
@@ -48,38 +48,16 @@ sub setup_local($$$) {
_("Printer Device") => {val => \$printer->{DEVICE}, list => \@port } ],
);
+ #- make the DeviceURI from DEVICE.
+ $printer->{DeviceURI} = ($printer->{DEVICE} =~ /usb/ ? "usb:" : "parallel:") . $_->{DEVICE};
+
foreach (@parport) {
$printer->{DEVICE} eq $_->{port} or next;
$printer->{DBENTRY} = $printer::descr_to_db{common::bestMatchSentence2($_->{val}{DESCRIPTION},
@printer::entry_db_description)};
- }
- 1;
-}
-
-sub setup_uri_local($$$) {
- my ($printer, $in, $install) = @_;
-
- my @str = ();
- my @parport = auto_detect($in);
- foreach (@parport) {
- $_->{val}{DESCRIPTION} and push @str, _("A printer, model \"%s\", has been detected on ",
- $_->{val}{DESCRIPTION}) . $_->{port};
- }
-
- my @direct_uri = printer::get_direct_uri();
- @parport and $printer->{DeviceURI} = ($parport[0]{port} =~ /usb/ ? "usb:" : "parallel:") . $parport[0]{port};
-
- return if !$in->ask_from_entries_refH(_("Local Printer Device (URI)"),
- _("What URI device is your printer connected to
-(note that parallel:/dev/lp0 is equivalent to LPT1:)?\n") . (join "\n", @str), [
-_("Printer Device URI") => { val => \$printer->{DeviceURI}, list => \@direct_uri } ],
- );
-
- foreach (@parport) {
- (split ':', $printer->{DeviceURI})[1] eq $_->{port} or next;
$printer->{cupsDescr} = common::bestMatchSentence2($_->{val}{DESCRIPTION}, keys %printer::descr_to_ppd);
}
- 1;
+ 1;
}
sub setup_remote($$$) {
@@ -150,19 +128,41 @@ _("Password") => {val => \$printer->{NCPPASSWD}, hidden => 1} ],
1;
}
-sub setup_uri_net($$$) {
+sub setup_socket($$$) {
+ my ($printer, $in, $install) = @_;
+ my ($hostname, $port);
+
+ return if !$in->ask_from_entries_refH(_("Socket Printer Options"),
+_("To print to a socket printer, you need to provide the
+hostname of the printer and optionally the port number."), [
+_("Printer Hostname") => \$hostname,
+_("Port") => \$port ],
+ );
+
+ #- make the DeviceURI parameters given above, these parameters are not in printer
+ #- structure as only the URI is needed (cups only).
+ $printer->{DeviceURI} = join '', ("socket://$hostname", $port ? (":$port") : ());
+ 1;
+}
+
+sub setup_uri($$$) {
my ($printer, $in, $install) = @_;
- return if !$in->ask_from_entries_refH(_("Network Printer Options (URI)"),
-_("Choose the right Device URI for a network printer or a local file. Examples:
- file:/path/to/filename.prn
- http://hostname:631/ipp/port1
- ipp://hostname/ipp/port1
- lpq://hostname/queue
- socket://hostname
- socket://hostname:9100"), [
-_("Printer Device URI") => \$printer->{DeviceURI} ],
- );
+ return if !$in->ask_from_entries_refH(_("Printer Device URI"),
+_("You can specify directly the URI to access the printer with CUPS."),
+_("Printer Device URI") => { val => \$printer->{DeviceURI}, list => [ printer::get_direct_uri(),
+ "file:/",
+ "http://",
+ "ipp://",
+ "lpq://",
+ "smb://",
+ "socket://",
+ ], },
+ );
+ if ($printer->{DeviceURI} =~ /^smb:/) {
+ &$install('samba');
+ printer::restart_queue($printer);
+ }
1;
}
@@ -381,8 +381,8 @@ You can add some more or change the existing ones."),
} else {
if ($printer->{mode} eq 'cups') {
$in->ask_from_entries_refH([_("Select Printer Connection"), _("Ok"), $::beginner ? () : _("Remove queue")],
-_("Every printer managed by CUPS need a name (for example lp).
-Other parameter like the description of the printer or its location
+_("Every printer need a name (for example lp).
+Other parameters such as the description of the printer or its location
can be defined. What name should be used for this printer and
how is the printer connected?"), [
_("Name of printer") => { val => \$printer->{QUEUE} },
@@ -409,13 +409,13 @@ _("Printer Connection") => { val => \$printer->{str_type}, list => [ printer::pr
$printer->{TYPE} = $printer::printer_type{$printer->{str_type}};
$continue = 0;
- for ($printer->{TYPE}) { #- chooser lpr/cups ? not good !
- /URI_LOCAL/ and setup_uri_local($printer, $in, $install) and last;
- /URI_NET/ and setup_uri_net ($printer, $in, $install) and last;
+ for ($printer->{TYPE}) {
/LOCAL/ and setup_local ($printer, $in, $install) and last;
- /REMOTE/ and setup_remote ($printer, $in, $install) and last; #- make common for cups/lpr ?
- /SMB/ and setup_smb ($printer, $in, $install) and last; #- make common for cups/lpr ?
+ /REMOTE/ and setup_remote ($printer, $in, $install) and last;
+ /SMB/ and setup_smb ($printer, $in, $install) and last;
/NCP/ and setup_ncp ($printer, $in, $install) and last;
+ /SOCKET/ and setup_socket ($printer, $in, $install) and last;
+ /URI/ and setup_uri ($printer, $in, $install) and last;
$continue = 1; last;
}
}