From 034ace25617a906128a88b271b6dd02068c36f3f Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Wed, 27 Aug 2003 16:24:23 +0000 Subject: Determine default printer already when reading in the queue data, this is much faster than running "foomatic-configure" a second time. --- perl-install/printer/main.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'perl-install/printer/main.pm') diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 1c9790be4..36e24806e 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -256,7 +256,7 @@ sub read_configured_queues($) { #- Poll the queues of the current default spooler local *F; open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . - "foomatic-configure -P -q -s $printer->{SPOOLER} |" or + "foomatic-configure -P -q -s $printer->{SPOOLER} -r |" or die "Could not run foomatic-configure"; eval join('', ); close F; @@ -265,6 +265,13 @@ sub read_configured_queues($) { my $i; my $N = $#QUEUES + 1; for ($i = 0; $i < $N; $i++) { + # Set the default printer + $printer->{DEFAULT} = $QUEUES[$i]{queuedata}{queue} if + $QUEUES[$i]{queuedata}{default}; + # Advance to the next entry if the current is a remotely defined + # printer + next if $QUEUES[$i]{queuedata}{remote}; + # Add an entry for a locally defined queue $printer->{configured}{$QUEUES[$i]{queuedata}{queue}} = $QUEUES[$i]; if (!$QUEUES[$i]{make} || !$QUEUES[$i]{model}) { @@ -272,9 +279,9 @@ sub read_configured_queues($) { $printer->{OLD_QUEUE} = $QUEUES[$i]{queuedata}{queue}; my $descr = get_descr_from_ppd($printer); if ($descr =~ m/^([^\|]*)\|([^\|]*)(\|.*|)$/) { - $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} ||= $1; - $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{model} ||= $2; - } + $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} ||= $1; + $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{model} ||= $2; + } # Read out which PPD file was originally used to set up this # queue local *F; -- cgit v1.2.1