line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Boxer::CLI::Command::Bootstrap; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding UTF-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=cut |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1767
|
use v5.20; |
|
3
|
|
|
|
|
10
|
|
8
|
3
|
|
|
3
|
|
13
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
21
|
|
9
|
3
|
|
|
3
|
|
74
|
use Role::Commons -all; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
14
|
|
10
|
3
|
|
|
3
|
|
3655
|
use feature 'signatures'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
218
|
|
11
|
3
|
|
|
3
|
|
18
|
use namespace::autoclean 0.16; |
|
3
|
|
|
|
|
38
|
|
|
3
|
|
|
|
|
14
|
|
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
884
|
use Path::Tiny; |
|
3
|
|
|
|
|
10035
|
|
|
3
|
|
|
|
|
191
|
|
14
|
3
|
|
|
3
|
|
982
|
use List::MoreUtils qw(before after); |
|
3
|
|
|
|
|
16142
|
|
|
3
|
|
|
|
|
24
|
|
15
|
3
|
|
|
3
|
|
2902
|
use Module::Runtime qw/use_module/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
21
|
|
16
|
3
|
|
|
3
|
|
136
|
use Boxer::CLI -command; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
17
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
808
|
use strictures 2; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
91
|
|
19
|
3
|
|
|
3
|
|
430
|
no warnings "experimental::signatures"; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
132
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 VERSION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Version v1.4.3 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = "v1.4.3"; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use constant { |
30
|
3
|
|
|
|
|
1387
|
abstract => q[bootstrap system image from abstract node], |
31
|
|
|
|
|
|
|
usage_desc => q[%c bootstrap %o NODE [NODE...] [-- helper-options]], |
32
|
3
|
|
|
3
|
|
14
|
}; |
|
3
|
|
|
|
|
6
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub description |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
0
|
1
|
0
|
<<'DESCRIPTION'; |
37
|
|
|
|
|
|
|
Bootstrap a system image. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Generate a filesystem image. Input is one or more abstract nodes |
40
|
|
|
|
|
|
|
to resolve using a set of abstract classes, and output is one or more |
41
|
|
|
|
|
|
|
images generated using a bootstrapping tool. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
DESCRIPTION |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub command_names |
47
|
|
|
|
|
|
|
{ |
48
|
5
|
|
|
5
|
1
|
248
|
qw( |
49
|
|
|
|
|
|
|
bootstrap |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub opt_spec |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
return ( |
56
|
0
|
|
|
0
|
1
|
|
[ "suite=s", "suite of classes to use (buster)" ], |
57
|
|
|
|
|
|
|
[ "nodedir=s", "location of nodes (current dir)" ], |
58
|
|
|
|
|
|
|
[ "classdir=s", "location of classes (XDG datadir + suite/classes)" ], |
59
|
|
|
|
|
|
|
[ "datadir=s", "location containing nodes and classes" ], |
60
|
|
|
|
|
|
|
[ "skeldir=s", "location of skeleton files (use builtin)" ], |
61
|
|
|
|
|
|
|
[ "mode=s", "mode passed to helper, and use sudo in sudo mode" ], |
62
|
|
|
|
|
|
|
[ "helper=s", "bootstrapping tool to use (mmdebstrap)" ], |
63
|
|
|
|
|
|
|
[ "nonfree", "enable use of contrib and non-free code" ], |
64
|
|
|
|
|
|
|
[ "dryrun", "only echo command, without executing it" ], |
65
|
|
|
|
|
|
|
[ "verbose|v", "verbose output" ], |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
sub execute ( $self, $opt, $args ) |
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
0
|
1
|
|
{ |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Log::Any::Adapter->set( 'Screen', default_level => 'info' ) |
72
|
0
|
0
|
|
|
|
|
if ( $opt->{verbose} ); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
|
|
my @args = before { $_ eq '--' } @{$args}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
|
|
my @helper_args = after { $_ eq '--' } @{$args}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $world = use_module('Boxer::Task::Classify')->new( |
78
|
|
|
|
|
|
|
suite => $opt->{suite}, |
79
|
|
|
|
|
|
|
nodedir => $opt->{nodedir}, |
80
|
|
|
|
|
|
|
classdir => $opt->{classdir}, |
81
|
|
|
|
|
|
|
datadir => $opt->{datadir}, |
82
|
0
|
|
|
|
|
|
)->run; |
83
|
0
|
|
|
|
|
|
for my $node (@args) { |
84
|
|
|
|
|
|
|
use_module('Boxer::Task::Bootstrap')->new( |
85
|
|
|
|
|
|
|
world => $world, |
86
|
|
|
|
|
|
|
helper => $opt->{helper} || 'mmdebstrap', |
87
|
|
|
|
|
|
|
mode => $opt->{mode}, |
88
|
|
|
|
|
|
|
helper_args => [@helper_args], |
89
|
|
|
|
|
|
|
nonfree => $opt->{nonfree}, |
90
|
|
|
|
|
|
|
dryrun => $opt->{dryrun}, |
91
|
0
|
|
0
|
|
|
|
node => $node, |
92
|
|
|
|
|
|
|
)->run; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHOR |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Jonas Smedegaard C<< >>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Copyright © 2019 Jonas Smedegaard |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
114
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
115
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |