summaryrefslogtreecommitdiffstats
path: root/perl-install/printer.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2002-09-19 23:25:04 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2002-09-19 23:25:04 +0000
commit6c2427e83461caa52161ba9d2b7b75d0d19af9ec (patch)
treeecbdc07e7f0d05f0663c1e228bb876a43529bbee /perl-install/printer.pm
parent87ecc7e1f8f0f22cc55cc9b3f2e087c9ead540d0 (diff)
downloaddrakx-backup-do-not-use-6c2427e83461caa52161ba9d2b7b75d0d19af9ec.tar
drakx-backup-do-not-use-6c2427e83461caa52161ba9d2b7b75d0d19af9ec.tar.gz
drakx-backup-do-not-use-6c2427e83461caa52161ba9d2b7b75d0d19af9ec.tar.bz2
drakx-backup-do-not-use-6c2427e83461caa52161ba9d2b7b75d0d19af9ec.tar.xz
drakx-backup-do-not-use-6c2427e83461caa52161ba9d2b7b75d0d19af9ec.zip
Fixed bug of printerdrake installing LPRng when it is started for the
first time and CUPS is already installed without local queues but with remote CUPS servers broadcasting in their printer info.
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r--perl-install/printer.pm38
1 files changed, 35 insertions, 3 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 9f3031720..7949999ad 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -193,6 +193,19 @@ sub stop_service ($) {
if (($? >> 8) != 0) { return 0 } else { return 1 }
}
+sub service_running ($) {
+ my ($service) = @_;
+ # Exit silently if the service is not installed
+ return 0 if (!(-x "$prefix/etc/rc.d/init.d/$service"));
+ run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "status");
+ # The exit status is not zero when the service is not running
+ if (($? >> 8) != 0) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
sub service_starts_on_boot ($) {
my ($service) = @_;
local *F;
@@ -699,6 +712,18 @@ sub read_configured_queues($) {
#- Find the first spooler where there are queues
my $spooler;
for $spooler (qw(cups pdq lprng lpd)) {
+ #- Is the spooler's daemon running?
+ my $service = $spooler;
+ if ($service eq "lprng") {
+ $service = "lpd";
+ }
+ if ($service ne "pdq") {
+ if (!service_running($service)) {
+ next;
+ }
+ # daemon is running, spooler found
+ $printer->{SPOOLER} = $spooler;
+ }
#- poll queue info
local *F;
open F, ($::testing ? $prefix : "chroot $prefix/ ") .
@@ -706,9 +731,16 @@ sub read_configured_queues($) {
die "Could not run foomatic-configure";
eval (join('',(<F>)));
close F;
- #- Have we found queues?
- if ($#QUEUES != -1) {
- $printer->{SPOOLER} = $spooler;
+ if ($service eq "pdq") {
+ #- Have we found queues? PDQ has no damon, so we consider
+ #- it in use when there are defined printer queues
+ if ($#QUEUES != -1) {
+ $printer->{SPOOLER} = $spooler;
+ last;
+ }
+ } else {
+ #- For other spoolers we have already found a running
+ #- daemon when we have arrived here
last;
}
}