summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2002-08-10 01:22:21 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2002-08-10 01:22:21 +0000
commitf51843fcf57353b204a2102ee853a9fbaa50219d (patch)
tree39d6fce8e8fce06bc67fbbdbd47b7668a7353211 /perl-install/detect_devices.pm
parent0722d266abba248fcf973a18e0fec1ffdc91744b (diff)
downloaddrakx-backup-do-not-use-f51843fcf57353b204a2102ee853a9fbaa50219d.tar
drakx-backup-do-not-use-f51843fcf57353b204a2102ee853a9fbaa50219d.tar.gz
drakx-backup-do-not-use-f51843fcf57353b204a2102ee853a9fbaa50219d.tar.bz2
drakx-backup-do-not-use-f51843fcf57353b204a2102ee853a9fbaa50219d.tar.xz
drakx-backup-do-not-use-f51843fcf57353b204a2102ee853a9fbaa50219d.zip
Scanning network for printers did not work during installation. Fixed.
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm50
1 files changed, 24 insertions, 26 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index f046873aa..7ecbd6f5e 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -695,40 +695,38 @@ sub getIPsInLocalNetworks {
my @local_bcasts;
my $current_bcast = "";
- if (-x "/sbin/ifconfig") {
- local *IFCONFIG_OUT;
- open IFCONFIG_OUT, "export LC_ALL=C; /sbin/ifconfig|" or die "Couldn't run \"ifconfig\"!";
- while (my $readline = <IFCONFIG_OUT>) {
- # New entry ...
- if ($readline =~ /^(\S+)\s/) {
- my $dev = $1;
- # ... for a local network (eth = ethernet,
- # vmnet = VMWare,
- # ethernet card connected to ISP excluded)?
- $dev_is_localnet = (($dev =~ /^eth/) || ($dev =~ /^vmnet/));
- # delete previous address
- $current_bcast = "";
- }
- # Are we in the important line now?
- if ($readline =~ /\sBcast:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) {
- # Rip out the broadcast IP address
- $current_bcast = $1;
-
- # Are we in an entry for a local network?
- if ($dev_is_localnet == 1) {
- # Store current IP address
- push @local_bcasts, $current_bcast;
- }
+ local *IFCONFIG_OUT;
+ open IFCONFIG_OUT, "export LC_ALL=C; ifconfig |" or return ();
+ while (my $readline = <IFCONFIG_OUT>) {
+ # New entry ...
+ if ($readline =~ /^(\S+)\s/) {
+ my $dev = $1;
+ # ... for a local network (eth = ethernet,
+ # vmnet = VMWare,
+ # ethernet card connected to ISP excluded)?
+ $dev_is_localnet = (($dev =~ /^eth/) || ($dev =~ /^vmnet/));
+ # delete previous address
+ $current_bcast = "";
+ }
+ # Are we in the important line now?
+ if ($readline =~ /\sBcast:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) {
+ # Rip out the broadcast IP address
+ $current_bcast = $1;
+
+ # Are we in an entry for a local network?
+ if ($dev_is_localnet == 1) {
+ # Store current IP address
+ push @local_bcasts, $current_bcast;
}
}
- close(IFCONFIG_OUT);
}
+ close(IFCONFIG_OUT);
my @addresses;
# Now ping all broadcast addresses
for my $bcast (@local_bcasts) {
local *F;
- open F, "ping -w 1 -b -n $bcast | cut -f 4 -d \" \" | sed s/:// | egrep \"^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\" | uniq |" or next;
+ open F, "export LC_ALL=C; ping -w 1 -b -n $bcast | cut -f 4 -d \" \" | sed s/:// | egrep \"^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\" | uniq |" or next;
while (<F>) { chomp; push @addresses, $_ }
close F;
}