summaryrefslogtreecommitdiffstats
path: root/common/scripts/DrakconnectConf.pm
blob: 9b9a4e06653b295cea96a6f00c8bbc50dbf8297a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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};
}