line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Software::Packager::Object::Aix |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Software::Packager::Object::Aix |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This module is extends Software::Packager::Object and adds extra methods for |
12
|
|
|
|
|
|
|
use by the AIX software packager. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 FUNCTIONS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Software::Packager::Object::Aix; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#################### |
21
|
|
|
|
|
|
|
# Standard Modules |
22
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
23
|
|
|
|
|
|
|
# Custom modules |
24
|
1
|
|
|
1
|
|
5
|
use Software::Packager::Object; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#################### |
27
|
|
|
|
|
|
|
# Variables |
28
|
1
|
|
|
1
|
|
4
|
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
725
|
|
29
|
|
|
|
|
|
|
@ISA = qw( Software::Packager::Object ); |
30
|
|
|
|
|
|
|
@EXPORT = qw(); |
31
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
32
|
|
|
|
|
|
|
$VERSION = 0.04; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $m_inventory_type_map; |
35
|
|
|
|
|
|
|
$m_inventory_type_map->{'directory'} = "DIRECTORY"; |
36
|
|
|
|
|
|
|
$m_inventory_type_map->{'file'} = "FILE"; |
37
|
|
|
|
|
|
|
$m_inventory_type_map->{'hardlink'} = undef; |
38
|
|
|
|
|
|
|
$m_inventory_type_map->{'softlink'} = "SYMLINK"; |
39
|
|
|
|
|
|
|
$m_inventory_type_map->{'install'} = undef; |
40
|
|
|
|
|
|
|
$m_inventory_type_map->{'config'} = "FILE"; |
41
|
|
|
|
|
|
|
$m_inventory_type_map->{'volatile'} = "FILE"; |
42
|
|
|
|
|
|
|
$m_inventory_type_map->{'pipe'} = "FIFO"; |
43
|
|
|
|
|
|
|
$m_inventory_type_map->{'charater'} = "CHAR_DEV"; |
44
|
|
|
|
|
|
|
$m_inventory_type_map->{'block'} = "BLK_DEV"; |
45
|
|
|
|
|
|
|
$m_inventory_type_map->{'multiplex'} = "MPX_DEV"; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#################### |
48
|
|
|
|
|
|
|
# Functions |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 B |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The LPP type for objects determines the type of LPP package created. |
53
|
|
|
|
|
|
|
If the objects destination is under /usr/share then the object is of type SHARE |
54
|
|
|
|
|
|
|
If the objects destination is under /usr then the object has a type of USER |
55
|
|
|
|
|
|
|
If the objects destination is under any other directory then the object has a |
56
|
|
|
|
|
|
|
type of ROOT+USER. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Note: when using the methods |
59
|
|
|
|
|
|
|
lpp_type_is_share() |
60
|
|
|
|
|
|
|
lpp_type_is_user() |
61
|
|
|
|
|
|
|
lpp_type_is_root() |
62
|
|
|
|
|
|
|
If the lpp_type_is_share() returns true then both lpp_type_is_user() and |
63
|
|
|
|
|
|
|
lpp_type_is_root() will also return true. |
64
|
|
|
|
|
|
|
Also if lpp_type_is_user() returns true then lpp_type_is_root() will also |
65
|
|
|
|
|
|
|
return true. |
66
|
|
|
|
|
|
|
So when calling these method do something like... |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
foreach my $object ($self->get_object_list()) |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
$share++ and next if $object->lpp_type_is_share(); |
71
|
|
|
|
|
|
|
$user++ and next if $object->lpp_type_is_user(); |
72
|
|
|
|
|
|
|
$root++ and next if $object->lpp_type_is_root(); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
################################################################################ |
78
|
|
|
|
|
|
|
# Function: lpp_type_is_share() |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 B |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$share++ if $object->lpp_type_is_share(); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Returns the true if the LPP is SHARE otherwise it returns undef. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
sub lpp_type_is_share |
88
|
|
|
|
|
|
|
{ |
89
|
20
|
|
|
20
|
1
|
24
|
my $self = shift; |
90
|
20
|
|
|
|
|
32
|
my $destination = $self->destination(); |
91
|
20
|
50
|
|
|
|
41
|
return '1' if $destination =~ m#^/usr/share#; |
92
|
20
|
|
|
|
|
48
|
return undef; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
################################################################################ |
96
|
|
|
|
|
|
|
# Function: lpp_type_is_user() |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 B |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$share++ if $object->lpp_type_is_user(); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns the true if the LPP is USER otherwise it returns undef. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
sub lpp_type_is_user |
106
|
|
|
|
|
|
|
{ |
107
|
20
|
|
|
20
|
1
|
66
|
my $self = shift; |
108
|
20
|
|
|
|
|
31
|
my $destination = $self->destination(); |
109
|
20
|
100
|
|
|
|
77
|
return '1' if $destination =~ m#^/usr#; |
110
|
2
|
|
|
|
|
6
|
return undef; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
################################################################################ |
114
|
|
|
|
|
|
|
# Function: lpp_type_is_root() |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 B |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$share++ if $object->lpp_type_is_root(); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns the true if the LPP is ROOT+USER otherwise it returns undef. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
sub lpp_type_is_root |
124
|
|
|
|
|
|
|
{ |
125
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
126
|
2
|
|
|
|
|
4
|
my $destination = $self->destination(); |
127
|
2
|
50
|
|
|
|
12
|
return '1' if $destination =~ m#^/#; |
128
|
0
|
|
|
|
|
0
|
return undef; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
################################################################################ |
132
|
|
|
|
|
|
|
# Function: inventory_type() |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 B |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
$type = $object->inventory_type(); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns the type of object to be added to the inventory file. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
sub inventory_type |
142
|
|
|
|
|
|
|
{ |
143
|
47
|
|
|
47
|
1
|
60
|
my $self = shift; |
144
|
47
|
|
|
|
|
140
|
return $m_inventory_type_map->{lc $self->type()}; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
################################################################################ |
148
|
|
|
|
|
|
|
# Function: destination() |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 B |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$object->destination($value); |
153
|
|
|
|
|
|
|
$destination = $object->destination(); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This method sets or returns the destination location for this object. |
156
|
|
|
|
|
|
|
The name of objects being installed cannot contain commas or colons. This is |
157
|
|
|
|
|
|
|
because commas and colons are used as delimiters in the control files used |
158
|
|
|
|
|
|
|
during the software installation process. |
159
|
|
|
|
|
|
|
Object names can contain non-ASCII charaters. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
162
|
|
|
|
|
|
|
sub destination |
163
|
|
|
|
|
|
|
{ |
164
|
4455
|
|
|
4455
|
1
|
23364
|
my $self = shift; |
165
|
4455
|
|
|
|
|
11286
|
my $value = shift; |
166
|
|
|
|
|
|
|
|
167
|
4455
|
100
|
|
|
|
5921
|
if ($value) |
168
|
|
|
|
|
|
|
{ |
169
|
30
|
100
|
|
|
|
109
|
if ($value =~ /\,|\:/) |
170
|
|
|
|
|
|
|
{ |
171
|
2
|
|
|
|
|
9
|
warn "Error: Cannot add object to the package: Objects cannot have names containing commas or colons.\n"; |
172
|
2
|
|
|
|
|
6
|
return undef; |
173
|
|
|
|
|
|
|
} |
174
|
28
|
|
|
|
|
92
|
$self->{'DESTINATION'} = $value; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
else |
177
|
|
|
|
|
|
|
{ |
178
|
4425
|
|
|
|
|
11586
|
return $self->{'DESTINATION'}; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
################################################################################ |
183
|
|
|
|
|
|
|
# Function: user() |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 B |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This method sets or returns the user name that this object should be installed |
188
|
|
|
|
|
|
|
as. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
191
|
|
|
|
|
|
|
sub user |
192
|
|
|
|
|
|
|
{ |
193
|
73
|
|
|
73
|
1
|
245
|
my $self = shift; |
194
|
73
|
|
|
|
|
126
|
my $value = shift; |
195
|
|
|
|
|
|
|
|
196
|
73
|
50
|
|
|
|
313
|
if ($value) |
197
|
|
|
|
|
|
|
{ |
198
|
|
|
|
|
|
|
# if we only have digits then get the name. |
199
|
0
|
0
|
|
|
|
0
|
if ($value =~ /^\d+$/) |
200
|
|
|
|
|
|
|
{ |
201
|
0
|
|
|
|
|
0
|
$value = getpwuid($value); |
202
|
|
|
|
|
|
|
} |
203
|
0
|
|
|
|
|
0
|
$self->{'USER'} = $value; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
else |
206
|
|
|
|
|
|
|
{ |
207
|
73
|
100
|
|
|
|
311
|
unless (scalar $self->{'USER'}) |
208
|
|
|
|
|
|
|
{ |
209
|
26
|
|
|
|
|
2553
|
$self->{'USER'} = getpwuid($<); |
210
|
|
|
|
|
|
|
} |
211
|
73
|
|
|
|
|
577
|
return $self->{'USER'}; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
################################################################################ |
216
|
|
|
|
|
|
|
# Function: group() |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 B |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
$object->group($value); |
221
|
|
|
|
|
|
|
$group = $object->group(); |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
This method sets or returns the group name that this object should be installed |
224
|
|
|
|
|
|
|
as. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
227
|
|
|
|
|
|
|
sub group |
228
|
|
|
|
|
|
|
{ |
229
|
73
|
|
|
73
|
1
|
146
|
my $self = shift; |
230
|
73
|
|
|
|
|
99
|
my $value = shift; |
231
|
|
|
|
|
|
|
|
232
|
73
|
50
|
|
|
|
178
|
if ($value) |
233
|
|
|
|
|
|
|
{ |
234
|
|
|
|
|
|
|
# if we only have digits then get the name. |
235
|
0
|
0
|
|
|
|
0
|
if ($value =~ /^\d+$/) |
236
|
|
|
|
|
|
|
{ |
237
|
0
|
|
|
|
|
0
|
$value = getgrgid($value); |
238
|
|
|
|
|
|
|
} |
239
|
0
|
|
|
|
|
0
|
$self->{'GROUP'} = $value; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
else |
242
|
|
|
|
|
|
|
{ |
243
|
73
|
100
|
|
|
|
514
|
unless (scalar $self->{'GROUP'}) |
244
|
|
|
|
|
|
|
{ |
245
|
26
|
|
|
|
|
168
|
my $groups = $(; |
246
|
26
|
|
|
|
|
93
|
my ($group, @rest) = split / /, $groups; |
247
|
26
|
|
|
|
|
1337
|
$self->{'GROUP'} = getgrgid($group); |
248
|
|
|
|
|
|
|
} |
249
|
73
|
|
|
|
|
475
|
return $self->{'GROUP'}; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
################################################################################ |
254
|
|
|
|
|
|
|
# Function: links() |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head2 B |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
This method adds to the list of hard links to add for the file. |
259
|
|
|
|
|
|
|
If no arguments are passed then a string containing the list is returned. |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=cut |
262
|
|
|
|
|
|
|
sub links |
263
|
|
|
|
|
|
|
{ |
264
|
21
|
|
|
21
|
1
|
90
|
my $self = shift; |
265
|
21
|
|
|
|
|
73
|
my $value = shift; |
266
|
|
|
|
|
|
|
|
267
|
21
|
100
|
|
|
|
405
|
if (defined $value) |
268
|
|
|
|
|
|
|
{ |
269
|
1
|
|
|
|
|
1
|
push @{$self->{'LINKS'}}, $value; |
|
1
|
|
|
|
|
4
|
|
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
else |
272
|
|
|
|
|
|
|
{ |
273
|
20
|
100
|
|
|
|
99
|
if (exists $self->{'LINKS'}) |
274
|
|
|
|
|
|
|
{ |
275
|
1
|
|
|
|
|
16
|
my $links = join ',', @{$self->{'LINKS'}}; |
|
1
|
|
|
|
|
11
|
|
276
|
1
|
|
|
|
|
89
|
return $links; |
277
|
|
|
|
|
|
|
} |
278
|
19
|
|
|
|
|
749
|
return undef; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
1; |
283
|
|
|
|
|
|
|
__END__ |