From cfd3a63ff8004529be3ac548290d216cb4fee460 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 12 Sep 2000 17:34:11 +0000 Subject: *** empty log message *** --- perl-install/install_steps.pm | 2 +- perl-install/install_steps_interactive.pm | 6 +++--- perl-install/printer.pm | 24 ++++++++++++++---------- perl-install/printerdrake.pm | 22 ++++++++++------------ 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 573619048..9de509b72 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -687,7 +687,7 @@ sub setupBootloaderBefore { require bootloader; #- propose the default fb mode for kernel fb, if aurora is installed too. bootloader::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion($o), - pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, 'Aurora') || {}) && 785); + pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, 'Aurora') || {}) && ($o->{vga} || 785)); if ($o->{miscellaneous}{profiles}) { my $e = bootloader::get_label("linux", $o->{bootloader}); push @{$o->{bootloader}{entries}}, { %$e, label => "office", append => "$e->{append} prof=Office" }; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 995ba0dae..7954d31cf 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -578,10 +578,10 @@ 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'; + $::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") ], + $o->{printer}{mode} = $o->ask_from_list_([''], _("Which printing system do you want to use?"), + [ 'CUPS', 'lpr', __("Cancel") ], ); $o->{printer}{want} = $o->{printer}{mode} ne 'Cancel'; $o->{printer}{want} or $o->{printer}{mode} = undef, return; diff --git a/perl-install/printer.pm b/perl-install/printer.pm index f524c33cd..f1f937ebe 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -18,7 +18,7 @@ my $PRINTER_FILTER_DIR = "/usr/lib/rhs/rhs-printfilters"; %printer_type = ( __("Local printer") => "LOCAL", __("Remote printer") => "REMOTE", - __("Remote cups server") => "CUPS", + __("Remote CUPS server") => "CUPS", __("Remote lpd server") => "LPD", __("Network printer (socket)") => "SOCKET", __("SMB/Windows 95/98/NT") => "SMB", @@ -46,7 +46,7 @@ sub default_spooldir($) { "/var/spool/lpd/" . default_queue($_[0]) } sub default_printer_type($) { "LOCAL" } sub printer_type($) { for ($_[0]{mode}) { - /cups/ && return @printer_type_inv{qw(LOCAL REMOTE SMB), $::expert ? qw(URI) : ()}; + /CUPS/ && return @printer_type_inv{qw(LOCAL REMOTE SMB), $::expert ? qw(URI) : ()}; /lpr/ && return @printer_type_inv{qw(LOCAL LPD SMB NCP)}; } } @@ -323,7 +323,7 @@ sub read_printers_conf { foreach () { chomp; /^\s*#/ and next; - if (/^\s*<(?:DefaultPrinter|Printer)\s+([^>]*)>/) { $current = { mode => 'cups', QUEUE => $1, } } + if (/^\s*<(?:DefaultPrinter|Printer)\s+([^>]*)>/) { $current = { mode => 'CUPS', QUEUE => $1, } } elsif (/\s*<\/Printer>/) { $current->{QUEUE} && $current->{DeviceURI} or next; #- minimal check of synthax. add2hash($printer->{configured}{$current->{QUEUE}} ||= {}, $current); $current = undef } elsif (/\s*(\S*)\s+(.*)/) { $current->{$1} = $2 } @@ -331,7 +331,7 @@ sub read_printers_conf { close PRINTERS; #- assume this printing system. - $printer->{mode} ||= 'cups'; + $printer->{mode} ||= 'CUPS'; } sub get_direct_uri { @@ -349,7 +349,8 @@ sub get_descr_from_ppd { my ($printer) = @_; my %ppd; - local *F; open F, "$prefix/etc/cups/ppd/$printer->{QUEUE}.ppd" or return; + #- if there is no ppd, this means this is the PostScript generic filter. + local *F; open F, "$prefix/etc/cups/ppd/$printer->{QUEUE}.ppd" or return "PostScript"; foreach () { /^\*([^\s:]*)\s*:\s*\"([^\"]*)\"/ and do { $ppd{$1} = $2; next }; /^\*([^\s:]*)\s*:\s*([^\s\"]*)/ and do { $ppd{$1} = $2; next }; @@ -381,6 +382,9 @@ sub poll_ppd_base { } scalar(keys %descr_to_ppd) > 5 or die "unable to connect to cups server"; + + #- assume a default printer not using any ppd at all. + $descr_to_ppd{"PostScript"} = ''; } #-****************************************************************************** @@ -449,7 +453,7 @@ sub configure_queue($) { my ($entry) = @_; for ($entry->{mode}) { - /cups/ && do { + /CUPS/ && do { #- at this level, we are using lpadmin to create a local printer (only local #- printer are supported with printerdrake). require run_program; @@ -457,7 +461,7 @@ sub configure_queue($) { "-p", $entry->{QUEUE}, $entry->{State} eq 'Idle' && $entry->{Accepting} eq 'Yes' ? ("-E") : (), "-v", $entry->{DeviceURI}, - "-m", $entry->{cupsPPD}, + $entry->{cupsPPD} ? ("-m", $entry->{cupsPPD}) : (), $entry->{Info} ? ("-D", $entry->{Info}) : (), $entry->{Location} ? ("-L", $entry->{Location}) : (), ); @@ -596,7 +600,7 @@ sub remove_queue($) { my ($printer) = @_; $printer->{configured}{$printer->{QUEUE}} or return; #- something strange at this point. - if ($printer->{mode} eq 'cups') { + if ($printer->{mode} eq 'CUPS') { require run_program; run_program::rooted($prefix, "lpadmin", "-x", $printer->{QUEUE}); } @@ -608,7 +612,7 @@ sub restart_queue($) { my $queue = default_queue($printer); for ($printer->{mode}) { - /cups/ && do { + /CUPS/ && do { #- restart cups before cleaning the queue. require run_program; run_program::rooted($prefix, "/etc/rc.d/init.d/cups start"); sleep 1; @@ -634,7 +638,7 @@ sub print_pages($@) { my ($lpr, $lpq); for ($printer->{mode}) { - /cups/ and ($lpr, $lpq) = ("/usr/bin/lpr-cups", "/usr/bin/lpq-cups"); + /CUPS/ and ($lpr, $lpq) = ("/usr/bin/lpr-cups", "/usr/bin/lpq-cups"); /lpr/ and ($lpr, $lpq) = ("/usr/bin/lpq-lpd", "/usr/bin/lpq-lpd"); } diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index b53285957..c5eafacd6 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -37,7 +37,6 @@ sub setup_local($$$) { } if (@str) { @port = map { $_->{port} } grep { $_->{val}{DESCRIPTION} } @parport; - #- in such case for a beginner, do not ask the port, get the first one. !$::expert && @port > 0 and $in = undef; } else { @port = detect_devices::whatPrinterPort(); @@ -45,7 +44,7 @@ sub setup_local($$$) { $printer->{DEVICE} = $port[0] if $port[0]; $in and return if !$in->ask_from_entries_refH(_("Local Printer Device"), - _("What device is your printer connected to +_("What device is your printer connected to (note that /dev/lp0 is equivalent to LPT1:)?\n") . (join "\n", @str), [ _("Printer Device") => {val => \$printer->{DEVICE}, list => \@port } ], ); @@ -65,7 +64,7 @@ _("Printer Device") => {val => \$printer->{DEVICE}, list => \@port } ], sub setup_remote($$$) { my ($printer, $in, $install) = @_; - $in->ask_from_entries_refH(_("Remote lpd Printer Options"), + return if !$in->ask_from_entries_refH(_("Remote lpd Printer Options"), _("To use a remote lpd print queue, you need to supply the hostname of the printer server and the queue name on that server which jobs should be placed in."), [ @@ -79,8 +78,7 @@ _("Remote queue") => \$printer->{REMOTEQUEUE}, ], sub setup_smb($$$) { my ($printer, $in, $install) = @_; - return if !$in->ask_from_entries_refH( - _("SMB (Windows 9x/NT) Printer Options"), + return if !$in->ask_from_entries_refH(_("SMB (Windows 9x/NT) Printer Options"), _("To print to a SMB printer, you need to provide the SMB host name (Note! It may be different from its TCP/IP hostname!) and possibly the IP address of the print server, as @@ -109,7 +107,7 @@ _("Workgroup") => \$printer->{SMBWORKGROUP} ], "/$printer->{SMBSHARE}"); &$install('samba'); - $printer->{mode} eq 'cups' and printer::restart_queue($printer); + $printer->{mode} eq 'CUPS' and printer::restart_queue($printer); 1; } @@ -171,7 +169,7 @@ _("Printer Device URI") => { val => \$printer->{DeviceURI}, list => [ printer::g sub setup_gsdriver($$$;$) { my ($printer, $in, $install, $upNetwork) = @_; for ($printer->{mode}) { - /cups/ && return setup_gsdriver_cups($printer, $in, $install, $upNetwork); + /CUPS/ && return setup_gsdriver_cups($printer, $in, $install, $upNetwork); /lpr/ && return setup_gsdriver_lpr($printer, $in, $install, $upNetwork); die "mode not chosen to configure a printer"; } @@ -183,7 +181,6 @@ sub setup_gsdriver_cups($$$;$) { while (1) { $printer->{cupsDescr} ||= printer::get_descr_from_ppd($printer); - print ">> $printer->{cupsDescr}\n"; $printer->{cupsDescr} = $in->ask_from_treelist('', _("What type of printer do you have?"), '|', [ keys %printer::descr_to_ppd ], $printer->{cupsDescr}) or return; $printer->{cupsPPD} = $printer::descr_to_ppd{$printer->{cupsDescr}}; @@ -361,7 +358,7 @@ You can add some more or change the existing ones."), #- switch according to what is being installed: cups, lpr or other. for ($printer->{mode}) { - /cups/ && do { &$install('cups-drivers') unless $::testing; + /CUPS/ && do { &$install('cups-drivers') unless $::testing; printer::poll_ppd_base(); last }; /lpr/ && do { &$install('rhs-printfilters') unless $::testing; printer::read_printer_db(); last }; @@ -373,7 +370,7 @@ You can add some more or change the existing ones."), while ($continue) { $printer::printer_type_inv{$printer->{TYPE}} or $printer->{TYPE} = printer::default_printer_type($printer); $printer->{str_type} = $printer::printer_type_inv{$printer->{TYPE}}; - if ($printer->{mode} eq 'cups') { + if ($printer->{mode} eq 'CUPS') { $printer->{str_type} = $in->ask_from_list_(_("Select Printer Connection"), _("How is the printer connected?"), [ printer::printer_type($printer) ], @@ -385,14 +382,15 @@ You can add some more or change the existing ones."), $printer->{str_type} = $in->ask_from_list_(_("Select Remote Printer Connection"), _("With a remote CUPS server, you do not have to configure any printer here; printers will be automatically detected. -In case of doubt, select \"Remote cups server\"."), +In case of doubt, select \"Remote CUPS server\"."), [ @printer::printer_type_inv{qw(CUPS LPD SOCKET)} ], $printer->{str_type}, ); $printer->{TYPE} = $printer::printer_type{$printer->{str_type}}; } $printer->{TYPE} eq 'CUPS' and return; #- exit printer configuration. - $in->ask_from_entries_refH([_("Select Printer Connection"), _("Ok"), $::beginner ? () : _("Remove queue")], + $in->ask_from_entries_refH([_("Select Printer Connection"), _("Ok"), + $::beginner || !$printer->{configured}{$printer->{QUEUE}} ? () : _("Remove queue")], _("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 -- cgit v1.2.1