| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Ixchel::Actions::systemd_journald_conf; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
107217
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
46
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
53
|
|
|
6
|
1
|
|
|
1
|
|
742
|
use Config::Tiny; |
|
|
1
|
|
|
|
|
1942
|
|
|
|
1
|
|
|
|
|
52
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use base 'Ixchel::Actions::base'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
564
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Ixchel::Actions::systemd_journald_conf - Generate a systemd journald config include. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.2.0 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.2.0'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 CLI SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
ixchel -a systemd_journald_conf |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
ixchel -a systemd_journald_conf B<-w> [B<--np>] [B<--die>] |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 CODE SYNOPSIS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Data::Dumper; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $results=$ixchel->action(action=>'systemd_journald_conf', opts=>{np=>1, w=>1, }); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This takes .config.systemd.journald and generates a config that can be used with journald. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
So if you would like to disable forward to wall, you can set .systemd.journald.ForwardToWall=no |
|
38
|
|
|
|
|
|
|
and it will generate the following... |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
[Journal] |
|
41
|
|
|
|
|
|
|
ForwardToWall=no |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 Switches |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 -w |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Write it out to /etc/systemd/journald.conf.d/99-ixchel.conf |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 --np |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Do not print out the results. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 RESULT HASH REF |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
.errors :: A array of errors encountered. |
|
56
|
|
|
|
|
|
|
.status_text :: A string description of what was done and the results. |
|
57
|
|
|
|
|
|
|
.ok :: Set to zero if any of the above errored. |
|
58
|
|
|
|
|
|
|
.filled_in :: The filled in template. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
0
|
0
|
|
sub new_extra { } |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub action_extra { |
|
65
|
0
|
|
|
0
|
0
|
|
my $self = $_[0]; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $string = ''; |
|
68
|
0
|
|
|
|
|
|
eval { |
|
69
|
|
|
|
|
|
|
my $config = Config::Tiny->new( |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
|
|
|
|
|
|
Journal => $self->{config}{systemd}{journald} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
0
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$string = $config->write_string; |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
if ( !-d '/etc/systemd/journald.conf.d/' ) { |
|
78
|
0
|
0
|
|
|
|
|
mkdir('/etc/systemd/journald.conf.d/') |
|
79
|
|
|
|
|
|
|
or die( 'Could not create /etc/systemd/journald.conf.d/ ...' . $@ ); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
if ( $self->{opts}{w} ) { |
|
83
|
0
|
|
|
|
|
|
write_file( '/etc/systemd/journald.conf.d/99-ixchel.conf', $string ); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
}; |
|
86
|
0
|
0
|
|
|
|
|
if ($@) { |
|
87
|
0
|
0
|
|
|
|
|
if ( !defined($string) ) { |
|
88
|
0
|
|
|
|
|
|
$string = ''; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
0
|
|
|
|
|
|
$self->status_add( status => $@ . "\n" . $string ); |
|
91
|
0
|
|
|
|
|
|
return undef; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$self->{results}{filled_in} = $string; |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
if ( !$self->{opts}{np} ) { |
|
97
|
0
|
|
|
|
|
|
print $string; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return undef; |
|
101
|
|
|
|
|
|
|
} ## end sub action_extra |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub short { |
|
104
|
0
|
|
|
0
|
1
|
|
return 'Generate a systemd journald config include'; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub opts_data { |
|
108
|
0
|
|
|
0
|
1
|
|
return 'w |
|
109
|
|
|
|
|
|
|
np |
|
110
|
|
|
|
|
|
|
die'; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |