Consistently "use strictures 2" in all source files.
[tails-persistence-setup.git] / bin / tails-persistence-setup
bloba2c830680907e56db912cd1cc9e84bf9e04e78a0
1 #!/usr/bin/perl
3 =head1 NAME
5 tails-persistence-setup - setup Tails persistent storage
7 =head1 VERSION
9 Version 1.1.12
11 =cut
13 use strictures 2;
14 use 5.10.1;
16 our $VERSION = '1.1.12';
18 use FindBin;
19 use lib "$FindBin::Bin/../lib";
21 my $mu;
22 sub record_memory_usage { 1 }
23 sub report_memory_usage { 1 }
25 my @options;
27 BEGIN {
28 if (exists $ENV{REPORT_MEMORY_USAGE}
29 && defined $ENV{REPORT_MEMORY_USAGE}
30 && $ENV{REPORT_MEMORY_USAGE}) {
31 require Memory::Usage;
32 $mu = Memory::Usage->new();
33 no warnings 'redefine';
34 *record_memory_usage = sub { $mu->record(shift) };
35 *report_memory_usage = sub { $mu->dump() };
36 push @options, ('memory_usage' => $mu);
37 say STDERR "Enabled memory usage reporting";
41 $SIG{'INT'} = $SIG{'TERM'} = sub { report_memory_usage(); exit(0); };
42 $SIG{'USR1'} = sub { report_memory_usage(); };
44 record_memory_usage('before loading Tails::Persistence::Setup');
45 use Tails::Persistence::Setup;
46 record_memory_usage('after loading Tails::Persistence::Setup');
48 Tails::Persistence::Setup->new_with_options()->run;
49 record_memory_usage('after Tails::Persistence::Setup->run is done');
51 report_memory_usage();