line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Pkg::SunOS; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
3
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
103
|
|
13
|
1
|
|
|
1
|
|
7
|
use Rex::Commands::File; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
14
|
1
|
|
|
1
|
|
7
|
use Rex::Pkg::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
15
|
1
|
|
|
1
|
|
23
|
use base qw(Rex::Pkg::Base); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
840
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
19
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
20
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$self->{commands} = {}; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub update { |
30
|
0
|
|
|
0
|
0
|
|
my ( $self, $pkg, $option ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
0
|
|
|
|
my $version = $option->{'version'} || ''; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
Rex::Logger::debug("Version option not supported."); |
35
|
0
|
|
|
|
|
|
Rex::Logger::debug("Installing $pkg / $version"); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $cmd = "pkgadd "; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
if ( !exists $option->{"source"} ) { |
40
|
0
|
|
|
|
|
|
die("You have to specify the source."); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
$cmd .= " -a " . $option->{"adminfile"} if ( $option->{"adminfile"} ); |
44
|
0
|
0
|
|
|
|
|
$cmd .= " -r " . $option->{"responsefile"} if ( $option->{"responsefile"} ); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$cmd .= " -d " . $option->{"source"}; |
47
|
0
|
|
|
|
|
|
$cmd .= " -n " . $pkg; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $f = i_run( $cmd, fail_ok => 1 ); |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
unless ( $? == 0 ) { |
52
|
0
|
|
|
|
|
|
Rex::Logger::info( "Error installing $pkg.", "warn" ); |
53
|
0
|
|
|
|
|
|
Rex::Logger::debug($f); |
54
|
0
|
|
|
|
|
|
die("Error installing $pkg"); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
Rex::Logger::debug("$pkg successfully installed."); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub remove { |
63
|
0
|
|
|
0
|
0
|
|
my ( $self, $pkg, $option ) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
Rex::Logger::debug("Removing $pkg"); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $cmd = "pkgrm -n "; |
68
|
0
|
0
|
|
|
|
|
$cmd .= " -a " . $option->{"adminfile"} if ( $option->{"adminfile"} ); |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $f = i_run( $cmd . " $pkg", fail_ok => 1 ); |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
unless ( $? == 0 ) { |
73
|
0
|
|
|
|
|
|
Rex::Logger::info( "Error removing $pkg.", "warn" ); |
74
|
0
|
|
|
|
|
|
Rex::Logger::debug($f); |
75
|
0
|
|
|
|
|
|
die("Error removing $pkg"); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
Rex::Logger::debug("$pkg successfully removed."); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return 1; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub get_installed { |
84
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my @lines = i_run "pkginfo -l"; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my ( @pkg, %current ); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
for my $line (@lines) { |
91
|
0
|
0
|
|
|
|
|
if ( $line =~ m/^$/ ) { |
92
|
0
|
|
|
|
|
|
push( @pkg, {%current} ); |
93
|
0
|
|
|
|
|
|
next; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
if ( $line =~ m/PKGINST:\s+([^\s]+)/ ) { |
97
|
0
|
|
|
|
|
|
$current{"name"} = $1; |
98
|
0
|
|
|
|
|
|
next; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if ( $line =~ m/VERSION:\s+([^\s]+)/ ) { |
102
|
0
|
|
|
|
|
|
my ( $version, $rev ) = split( /,/, $1 ); |
103
|
0
|
|
|
|
|
|
$current{"version"} = $version; |
104
|
0
|
0
|
|
|
|
|
$rev =~ s/^REV=// if ($rev); |
105
|
0
|
|
|
|
|
|
$current{"revision"} = $rev; |
106
|
0
|
|
|
|
|
|
next; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
if ( $line =~ m/STATUS:\s+(.*?)$/ ) { |
110
|
0
|
0
|
|
|
|
|
$current{"status"} = ( $1 eq "completely installed" ? "installed" : $1 ); |
111
|
0
|
|
|
|
|
|
next; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return @pkg; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |