summaryrefslogtreecommitdiffstats
path: root/perl-install/printer.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2002-09-11 14:42:58 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2002-09-11 14:42:58 +0000
commitcd373c13d4e97d8a2f93f7653308a7c54f517720 (patch)
tree33a23126a0fdbfb8b5a2caeec83e1998ff85fcd4 /perl-install/printer.pm
parent78cb266217da384c89d01d1c51cb8aa8d58cb7c8 (diff)
downloaddrakx-backup-do-not-use-cd373c13d4e97d8a2f93f7653308a7c54f517720.tar
drakx-backup-do-not-use-cd373c13d4e97d8a2f93f7653308a7c54f517720.tar.gz
drakx-backup-do-not-use-cd373c13d4e97d8a2f93f7653308a7c54f517720.tar.bz2
drakx-backup-do-not-use-cd373c13d4e97d8a2f93f7653308a7c54f517720.tar.xz
drakx-backup-do-not-use-cd373c13d4e97d8a2f93f7653308a7c54f517720.zip
- Made printer::assure_device_is_available_for_cups() more reliable by
checking and retrying. - Do not start the network when it is not configured.
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r--perl-install/printer.pm29
1 files changed, 19 insertions, 10 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index c671eb036..3276f3314 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -274,19 +274,23 @@ sub assure_device_is_available_for_cups {
# file:/dev/null instead. Restart CUPS if necessary to assure that
# CUPS knows the device.
my ($device) = @_;
- local *F;
- open F, ($::testing ? $prefix : "chroot $prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" or
+ my $result;
+ for ($i = 0; $i < 3; $i++) {
+ local *F;
+ open F, ($::testing ? $prefix : "chroot $prefix/ ") .
+ "/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" or
die "Could not run \"lpinfo\"!";
- while (my $line = <F>) {
- if ($line =~ /$device/) { # Found a line containing the device name,
- # so CUPS knows it.
- close F;
- return 1;
+ while (my $line = <F>) {
+ if ($line =~ /$device/) { # Found a line containing the device
+ # name, so CUPS knows it.
+ close F;
+ return 1;
+ }
}
+ close F;
+ $result = SIGHUP_daemon("cups");
}
- close F;
- return SIGHUP_daemon("cups");
+ return $result;
}
sub network_running {
@@ -416,6 +420,11 @@ sub getIPsInLocalNetworks {
# subroutine determines the list of all hosts reachable in the local
# networks by means of pinging the broadcast addresses.
+ # Return an empty list if no network is running
+ if (!network_running()) {
+ return ();
+ }
+
# Read the output of "ifconfig" to determine the broadcast addresses of
# the local networks
my $dev_is_localnet = 0;