From 8f5aea5c59228ff4e71ba8951313d59fbfd99723 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Mon, 9 Dec 2002 17:24:23 +0000 Subject: No more use of drakconnect_conf, use of IFCFG.pm instead of DrakconnectConf.pm --- common/scripts/IFCFG.pm | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'common') diff --git a/common/scripts/IFCFG.pm b/common/scripts/IFCFG.pm index 00a98845..2d1171ba 100644 --- a/common/scripts/IFCFG.pm +++ b/common/scripts/IFCFG.pm @@ -23,11 +23,11 @@ use strict; use Data::Dumper; use MDK::Common; -my $file = "/etc/sysconfig/network-scripts/drakconnect_conf"; -!-f $file and die "no such $file"; +#my $file = "/etc/sysconfig/network-scripts/drakconnect_conf"; +#!-f $file and die "no such $file"; sub new { my $self = {}; - + $ENV{PATH} = ""; my $ifconfig = `LC_ALL=C /sbin/ifconfig -a`; my $device = 'NONE'; @@ -42,7 +42,7 @@ sub new { $self->{itf}{$device}{$_} = $conf{$_} foreach ('BOOTPROTO'); } } - $self->{network} = getVarsFromSh("/etc/sysconfig/network"); + %{$self->{network}} = getVarsFromSh("/etc/sysconfig/network"); bless $self; } @@ -54,15 +54,6 @@ sub is_dhcp { $self->{itf}{$itf}{BOOTPROTO} eq 'dhcp'; } - -sub get { - my $self = shift; - my ($key1, $key2) = @_; - - exists $self->{$key1}{$key2} or die "no $key1 $key2 field in $file"; - $self->{$key1}{$key2}; -} - #- TODO : return the main interface sub default_itf { "eth0"; @@ -73,7 +64,7 @@ sub itf_get { my ($key, $itf) = @_; $itf ||= default_itf; - exists $self->{itf}{$itf}{$key} or die "no $key field in $file"; + exists $self->{itf}{$itf}{$key} or die "no $key field in $itf hash"; $self->{itf}{$itf}{$key} } @@ -81,7 +72,8 @@ sub network_get { my $self = shift; my ($key) = @_; - get("network", $key); + exists $self->{network}->{$key} or die "no $key field in network hash"; + $self->{network}{$key}; } 10; -- cgit v1.2.1