From 6b1badfc68e62482b8f0d3eb69c7524a3e7adaf7 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Wed, 7 Aug 2002 09:51:48 +0000 Subject: drakconnect conf file parser --- common/scripts/DrakconnectConf.pm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 common/scripts/DrakconnectConf.pm diff --git a/common/scripts/DrakconnectConf.pm b/common/scripts/DrakconnectConf.pm new file mode 100644 index 00000000..9b9a4e06 --- /dev/null +++ b/common/scripts/DrakconnectConf.pm @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +package DrakconnectConf; +require "__WIZ_HOME__/common/scripts/Vareqval.pm"; +use strict; + +sub new { + my $self = {}; + + my %mdk = Vareqval->get("/etc/sysconfig/network-scripts/drakconnect_conf"); + $self->{mdk} = \%mdk; + foreach (keys %{$self->{mdk}}) { + if (/.*(Eth\d)Known.*/) { + my $device = $1; + if ($self->{mdk}{$_} =~ /.*true.*/) { + $self->{device} = $device; + } + } + } + bless $self; +} + +sub get { + my $self = shift; + my $key = shift; + + return $self->{mdk}->{$key}; +} + +sub get_from_known_dev { + my $self = shift; + my $arg = shift; + + my $device = $self->{device}; + return $self->{mdk}{$device.$arg}; +} -- cgit v1.2.1