1 | 1 | simandl | package HotSaNICmod::common; |
2 | | | |
3 | | | sub version { |
4 | | | ($VERSION = '$Revision: 1.2 $') =~ s/.*(\d+\.\d+).*/$1/; |
5 | | | return "common.pm $VERSION"; |
6 | | | } |
7 | | | |
8 | | | sub configure { |
9 | | | |
10 | | | $MODARGS{NFSPARTS}=0; |
11 | | | $MODARGS{NUM}=0; |
12 | | | |
13 | | | # build summary of all partitions with existing databases |
14 | | | # |
15 | | | opendir(DIR, "rrd") || HotSaNICmod::dupe_control("die",$MODNAME,": can't open dir $!"); |
16 | | | @arr = grep(/\.rrd/,readdir(DIR)); |
17 | | | closedir DIR; |
18 | | | foreach $_ (@arr) { |
19 | | | ($name) = split /\.rrd/; |
20 | | | $MODARGS{"DRIVE:$name"}=0; |
21 | | | } |
22 | | | |
23 | | | # add configured drives |
24 | | | foreach (@_) { |
25 | | | ($var,$value)=HotSaNICparser::parse_line($_); |
26 | | | if ($var eq "DRIVE") { |
27 | | | my ($dev,$name)=split /,/,$value; |
28 | | | if (!defined $MODARGS{$dev}) { $MODARGS{NUM}++; } |
29 | | | $MODARGS{"DRIVE:$dev"}=1; |
30 | | | if ( index($dev,":") >0 ) { $MODARGS{NFSPARTS}++; } |
31 | | | } |
32 | | | } |
33 | | | return %MODARGS |
34 | | | } |
35 | | | |
36 | | | 1; |
37 | | | |