Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 62f3845b

Von Wulf Coulmann vor mehr als 13 Jahren hinzugefügt

  • ID 62f3845b7d45292676bb983c02015cb914727394
  • Vorgänger 0dc65e85
  • Nachfolger 1f7d4ae3

installation_check: Negation und short option bundling

Unterschiede anzeigen:

scripts/installation_check.pl
use SL::InstallationCheck;
my %check;
Getopt::Long::Configure ("bundling");
GetOptions(
"verbose" => \ my $v,
"all" => \ my $a,
"optional!" => \ my $o,
"devel!" => \ my $d,
"required!" => \ ( my $r = 1 ),
"help" => sub { pod2usage(-verbose => 2) },
"color" => \ ( my $c = 1 ),
"v|verbose" => \ my $v,
"a|all" => \ $check{a},
"o|optional!" => \ $check{o},
"d|devel!" => \ $check{d},
"r|required!" => \ $check{r},
"h|help" => sub { pod2usage(-verbose => 2) },
"c|color!" => \ ( my $c = 1 ),
);
$d = $r = $o = 1 if $a;
# if notihing is requested check "required"
$check{r} = 1 unless defined $check{a} ||
defined $check{o} ||
defined $check{d};
if ($check{a}) {
foreach my $check (keys %check) {
$check{$check} = 1 unless defined $check{$check};
}
}
$| = 1;
if ($r) {
if ($check{r}) {
check($_, required => 1) for @SL::InstallationCheck::required_modules;
}
if ($o) {
if ($check{o}) {
check($_, optional => 1) for @SL::InstallationCheck::optional_modules;
}
if ($d) {
if ($check{d}) {
check($_, devel => 1) for @SL::InstallationCheck::developer_modules;
}
......
my ($module, %role) = @_;
my $line = "Looking for $module->{fullname}";
print $line;
my $res = SL::InstallationCheck::module_available($module->{"name"}, $module->{version});
print dot_pad(length $line, $res ? 2 : 6, $res ? mycolor("ok", 'green') : mycolor("NOT ok", 'red')), $/;
print_result($line, $res);
return if $res;
......
return colored(@_);
}
sub dot_pad {
my ($s, $l, $text) = @_;
print " ";
print '.' x (80 - $s - 2 - $l);
print " ";
return $text;
sub print_result {
my ($test, $exit) = @_;
print $test, " ", ('.' x (72 - length $test));
print $exit ? '.... '. mycolor('ok', 'green') : ' '. mycolor('NOT ok', 'red');
print "\n";
return;
}
1;
......
=head1 DESCRIPTION
List all modules needed by Lx-Office, probes for them, and warns if one is not available.
Check dependencys. List all perl modules needed by Lx-Office, probes for them,
and warns if one is not available.
=head1 OPTIONS
=over 4
......
Color output. Default on.
=item C<--no-color>
No color output. Helpful to avoid terminal escape problems.
=item C<-d, --devel>
Probe for developer dependancies. (Used for console and tags file)
=item C<--no-devel>
Dont't probe for developer dependancies. (Useful in combination with --all)
=item C<-h, --help>
Display this help.
......
Probe for optional modules.
=item C<--no-optional>
Dont't probe for optional modules. (Useful in combination with --all)
=item C<-r, --required>
Probe for required modules (default).
=item C<--no-required>
Dont't probe for required modules. (Useful in combination with --all)
=item C<-v. --verbose>
Print additional info for modules that are missing
Print additional info for missing dependancies
=back
......
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
Wulf Coulmann E<lt>wulf@coulmann.deE<gt>
=cut

Auch abrufbar als: Unified diff