| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package RedHat::SysConfig; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.005; |
|
4
|
2
|
|
|
2
|
|
4772
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
60
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
5302
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.3'; |
|
8
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
##################################################################### |
|
11
|
|
|
|
|
|
|
# SysConfig.pm |
|
12
|
|
|
|
|
|
|
# by Patrick Devine (c) 2001 |
|
13
|
|
|
|
|
|
|
# patrick@bubblehockey.org |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# This software is covered under the same terms as Perl itself. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# WARNING: |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# This software is no where near finished and lots of stuff will |
|
20
|
|
|
|
|
|
|
# probably change before it is officially released (as 1.0). |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
##################################################################### |
|
24
|
|
|
|
|
|
|
# method: new |
|
25
|
|
|
|
|
|
|
# function: constructor method for creating an object |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
|
28
|
2
|
|
|
2
|
0
|
47
|
my $proto = shift; |
|
29
|
2
|
|
33
|
|
|
14
|
my $class = ref( $proto ) || $proto; |
|
30
|
2
|
|
|
|
|
4
|
my $self = {}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
6
|
bless( $self, $class ); |
|
33
|
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
6
|
$self; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
##################################################################### |
|
40
|
|
|
|
|
|
|
# method: DESTROY |
|
41
|
|
|
|
|
|
|
# function: destructor method for object cleanup |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
|
0
|
sub DESTROY { }; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
##################################################################### |
|
47
|
|
|
|
|
|
|
# method: AUTOLOAD |
|
48
|
|
|
|
|
|
|
# function: autoload function for creating undefined methods |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
51
|
2
|
|
|
2
|
|
30
|
my $self = shift; |
|
52
|
2
|
|
|
|
|
4
|
my $params = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
3
|
my $name = $AUTOLOAD; |
|
55
|
|
|
|
|
|
|
|
|
56
|
2
|
|
|
|
|
11
|
$name =~ s/ .* : //x; |
|
57
|
|
|
|
|
|
|
|
|
58
|
2
|
50
|
|
|
|
11
|
if( ref( $params ) eq 'HASH' ) { |
|
59
|
2
|
|
|
|
|
4
|
for( keys %{ $params } ) { |
|
|
2
|
|
|
|
|
13
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
11
|
my $prefix = substr( $_, 0, 1 ); |
|
62
|
4
|
|
|
|
|
7
|
my $param = substr( $_, 1 ); |
|
63
|
|
|
|
|
|
|
|
|
64
|
4
|
50
|
|
|
|
13
|
if( $prefix eq '-' ) { |
|
|
|
50
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
delete $self->{settings}->{$name}->{$param}; |
|
66
|
|
|
|
|
|
|
} elsif( $prefix eq '+' ) { |
|
67
|
0
|
|
|
|
|
0
|
$self->{settings}->{$name}->{$param} = $$params{$_}; |
|
68
|
|
|
|
|
|
|
} else { |
|
69
|
4
|
|
|
|
|
27
|
$self->{settings}->{$name}->{$_} = $$params{$_}; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
} else { |
|
74
|
0
|
|
|
|
|
|
$self->{settings}->{$name} = { $name => $params }; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
##################################################################### |
|
81
|
|
|
|
|
|
|
# method: package |
|
82
|
|
|
|
|
|
|
# function: adds or removes packages |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub package { |
|
85
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
86
|
0
|
|
|
|
|
|
my $params = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
_set_hashofhash( $self, 'package', $params ); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
##################################################################### |
|
94
|
|
|
|
|
|
|
# method: partition |
|
95
|
|
|
|
|
|
|
# function: adds or removes partitions from the partition list |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub part { |
|
98
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
99
|
0
|
|
|
|
|
|
my $params = shift; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
_set_listofhash( $self, 'dir', 'partition', $params ); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub partition { |
|
106
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
107
|
0
|
|
|
|
|
|
my $params = shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
_set_listofhash( $self, 'dir', 'partition', $params ); |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
##################################################################### |
|
115
|
|
|
|
|
|
|
# method: raid |
|
116
|
|
|
|
|
|
|
# function: adds or removes sw raid entries from the raid list |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub raid { |
|
119
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
120
|
0
|
|
|
|
|
|
my $params = shift; |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
_set_listofhash( $self, 'device', 'raid', $params ); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
##################################################################### |
|
128
|
|
|
|
|
|
|
# method: service |
|
129
|
|
|
|
|
|
|
# function: adds or removes service entries from the service list |
|
130
|
|
|
|
|
|
|
# (such as inetd and initd services) |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub service { |
|
133
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
134
|
0
|
|
|
|
|
|
my $params = shift; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
_set_listofhash( $self, 'name', 'service', $params ); |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
##################################################################### |
|
142
|
|
|
|
|
|
|
# method: device |
|
143
|
|
|
|
|
|
|
# function: add or remove an extra device for the device list |
|
144
|
|
|
|
|
|
|
# (useful for including devices which are not |
|
145
|
|
|
|
|
|
|
# autodetected by the installer) |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub device { |
|
148
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
149
|
0
|
|
|
|
|
|
my $params = shift; |
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
_set_listofhash( $self, 'module', 'device', $params ); |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
##################################################################### |
|
157
|
|
|
|
|
|
|
# method: _set_hashofhash |
|
158
|
|
|
|
|
|
|
# function: turn settings inside of our hash on or off |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub _set_hashofhash { |
|
161
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
162
|
0
|
|
|
|
|
|
my $type = shift; |
|
163
|
0
|
|
|
|
|
|
my $params = shift; |
|
164
|
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
|
if( ref( $params ) eq 'ARRAY' ) { |
|
166
|
0
|
|
|
|
|
|
for( @{ $params } ) { |
|
|
0
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
my $prefix = substr( $_, 0, 1 ); |
|
169
|
0
|
|
|
|
|
|
my $param = substr( $_, 1 ); |
|
170
|
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
|
if( $prefix eq '-' ) { |
|
|
|
0
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$param} = 'off'; |
|
173
|
|
|
|
|
|
|
} elsif( $prefix eq '+' ) { |
|
174
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$param} = 'on'; |
|
175
|
|
|
|
|
|
|
} else { |
|
176
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$_} = 'on'; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
} else { |
|
181
|
0
|
|
|
|
|
|
my $prefix = substr( $params, 0, 1 ); |
|
182
|
0
|
|
|
|
|
|
my $param = substr( $params, 1 ); |
|
183
|
|
|
|
|
|
|
|
|
184
|
0
|
0
|
|
|
|
|
if( $prefix eq '-' ) { |
|
|
|
0
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$param} = 'off'; |
|
186
|
|
|
|
|
|
|
} elsif( $prefix eq '+' ) { |
|
187
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$param} = 'on'; |
|
188
|
|
|
|
|
|
|
} else { |
|
189
|
0
|
|
|
|
|
|
$self->{settings}->{$type}->{$params} = 'on'; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
} |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
##################################################################### |
|
196
|
|
|
|
|
|
|
# method: _set_listofhash |
|
197
|
|
|
|
|
|
|
# function: turn settings inside of our list on or off |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub _set_listofhash { |
|
200
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
201
|
0
|
|
|
|
|
|
my $key = shift; |
|
202
|
0
|
|
|
|
|
|
my $type = shift; |
|
203
|
0
|
|
|
|
|
|
my $params = shift; |
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
0
|
|
|
|
|
if( ref( $params ) eq 'HASH' ) { |
|
206
|
|
|
|
|
|
|
|
|
207
|
0
|
0
|
|
|
|
|
return unless exists $$params{$key}; |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
my $prefix = substr( $$params{$key}, 0, 1 ); |
|
210
|
0
|
|
|
|
|
|
my $param = substr( $$params{$key}, 1 ); |
|
211
|
|
|
|
|
|
|
|
|
212
|
0
|
0
|
|
|
|
|
if( $prefix eq '-' ) { |
|
|
|
0
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
my @list; |
|
214
|
0
|
|
|
|
|
|
for( @{ $self->{settings}->{$type} } ) { |
|
|
0
|
|
|
|
|
|
|
|
215
|
0
|
0
|
|
|
|
|
push( @list, $_ ) |
|
216
|
|
|
|
|
|
|
unless $_->{$key} eq $param; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
0
|
|
|
|
|
|
@{ $self->{settings}->{$type} } = @list; |
|
|
0
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} elsif( $prefix eq '+' ) { |
|
220
|
0
|
|
|
|
|
|
$$params{$key} = $param; |
|
221
|
0
|
|
|
|
|
|
push @{ $self->{settings}->{$type} }, $params; |
|
|
0
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
} else { |
|
223
|
0
|
|
|
|
|
|
push @{ $self->{settings}->{$type} }, $params; |
|
|
0
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
1; |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
__END__ |