line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Pkg::OpenBSD; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Rex::Helper::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
13
|
1
|
|
|
1
|
|
8
|
use Rex::Commands::File; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
14
|
1
|
|
|
1
|
|
9
|
use Rex::Pkg::Base; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
15
|
1
|
|
|
1
|
|
43
|
use base qw(Rex::Pkg::Base); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
387
|
|
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
|
|
|
|
|
|
|
$self->{commands} = { |
25
|
0
|
|
|
|
|
|
install => '/usr/sbin/pkg_add %s', |
26
|
|
|
|
|
|
|
install_version => '/usr/sbin/pkg_add %s-%s', |
27
|
|
|
|
|
|
|
remove => '/usr/sbin/pkg_delete %s', |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub remove { |
34
|
0
|
|
|
0
|
0
|
|
my ( $self, $pkg ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my ($pkg_found) = grep { $_->{"name"} eq "$pkg" } $self->get_installed(); |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $pkg_version = $pkg_found->{"version"}; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $self->SUPER::remove("$pkg-$pkg_version"); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_installed { |
43
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my @lines = i_run "/usr/sbin/pkg_info"; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @pkg; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
for my $line (@lines) { |
50
|
0
|
|
|
|
|
|
my ( $pkg_name_v, $descr ) = split( /\s/, $line, 2 ); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my ( $pkg_name, $pkg_version ) = ( $pkg_name_v =~ m/^(.*)-(.*?)$/ ); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
push( |
55
|
|
|
|
|
|
|
@pkg, |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
name => $pkg_name, |
58
|
|
|
|
|
|
|
version => $pkg_version, |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return @pkg; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |