diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-13 15:58:19 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-13 15:58:19 +0000 |
commit | a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e (patch) | |
tree | c2a1abb5d2e07bc3ed0f40720d2abbf81474ddb5 | |
parent | 0e62495c91299a23ca0e6302af31a0c84fe64c0b (diff) | |
download | drakwizard-a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e.tar drakwizard-a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e.tar.gz drakwizard-a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e.tar.bz2 drakwizard-a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e.tar.xz drakwizard-a09c2df79dfc4f3ae41a4afcafb9338f3517ba3e.zip |
added is_dhcp
-rw-r--r-- | common/scripts/DrakconnectConf.pm | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/common/scripts/DrakconnectConf.pm b/common/scripts/DrakconnectConf.pm index 9b9a4e06..80ddbbfb 100644 --- a/common/scripts/DrakconnectConf.pm +++ b/common/scripts/DrakconnectConf.pm @@ -4,27 +4,40 @@ package DrakconnectConf; require "__WIZ_HOME__/common/scripts/Vareqval.pm"; use strict; +my $file = "/etc/sysconfig/network-scripts/drakconnect_conf"; sub new { my $self = {}; - my %mdk = Vareqval->get("/etc/sysconfig/network-scripts/drakconnect_conf"); + my %mdk = Vareqval->get($file); $self->{mdk} = \%mdk; foreach (keys %{$self->{mdk}}) { if (/.*(Eth\d)Known.*/) { my $device = $1; - if ($self->{mdk}{$_} =~ /.*true.*/) { - $self->{device} = $device; - } + $self->{mdk}{$_} =~ /.*true.*/ and $self->{device} = $device; } } + !$self->{device} and return -1; bless $self; } +sub get_device { + my $self = shift; + + $self->{device}; +} + +sub is_dhcp { + my $self = shift; + + $self->get_from_known_dev("BootProto") =~ /.*dhcp.*/; +} + sub get { my $self = shift; my $key = shift; - return $self->{mdk}->{$key}; + exists $self->{mdk}->{$key} or die "no $key field in $file"; + $self->{mdk}->{$key}; } sub get_from_known_dev { @@ -32,5 +45,6 @@ sub get_from_known_dev { my $arg = shift; my $device = $self->{device}; - return $self->{mdk}{$device.$arg}; + exists $self->{mdk}{$device.$arg} or die "no $arg for $device in $file"; + $self->{mdk}{$device.$arg}; } |