line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# system::ubuntu::service Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::System::Ubuntu::Service; |
7
|
1
|
|
|
1
|
|
736
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
36
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
299
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
attributes_default => { |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
commands => { |
23
|
|
|
|
|
|
|
enable => [ qw(service_name) ], |
24
|
|
|
|
|
|
|
disable => [ qw(service_name) ], |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
require_binaries => { |
27
|
|
|
|
|
|
|
'update-rc.d' => [ ], |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
#need_packages => { |
30
|
|
|
|
|
|
|
#ubuntu => [ qw() ], |
31
|
|
|
|
|
|
|
#debian => [ qw() ], |
32
|
|
|
|
|
|
|
#kali => [ qw() ], |
33
|
|
|
|
|
|
|
#}, |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub enable { |
38
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my ($service_name) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('enable', $service_name) or return; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $cmd = "update-rc.d \"$service_name\" enable"; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub disable { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
my ($service_name) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('disable', $service_name) or return; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $cmd = "update-rc.d \"$service_name\" disable"; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |