Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 62f3845b

Von Wulf Coulmann vor fast 13 Jahren hinzugefügt

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

installation_check: Negation und short option bundling

Unterschiede anzeigen:

scripts/installation_check.pl
12 12

  
13 13
use SL::InstallationCheck;
14 14

  
15
my %check;
16
Getopt::Long::Configure ("bundling");
15 17
GetOptions(
16
  "verbose"   => \ my $v,
17
  "all"       => \ my $a,
18
  "optional!" => \ my $o,
19
  "devel!"    => \ my $d,
20
  "required!" => \ ( my $r = 1 ),
21
  "help"      => sub { pod2usage(-verbose => 2) },
22
  "color"     => \ ( my $c = 1 ),
18
  "v|verbose"   => \ my $v,
19
  "a|all"       => \ $check{a},
20
  "o|optional!" => \ $check{o},
21
  "d|devel!"    => \ $check{d},
22
  "r|required!" => \ $check{r},
23
  "h|help"      => sub { pod2usage(-verbose => 2) },
24
  "c|color!"    => \ ( my $c = 1 ),
23 25
);
24 26

  
25
$d = $r = $o = 1 if $a;
27
# if notihing is requested check "required"
28
$check{r} = 1 unless defined $check{a} ||
29
                     defined $check{o} ||
30
                     defined $check{d};
31

  
32
if ($check{a}) {
33
  foreach my $check (keys %check) {
34
    $check{$check} = 1 unless defined $check{$check};
35
  }
36
}
37

  
26 38

  
27 39
$| = 1;
28 40

  
29
if ($r) {
41
if ($check{r}) {
30 42
  check($_, required => 1) for @SL::InstallationCheck::required_modules;
31 43
}
32
if ($o) {
44
if ($check{o}) {
33 45
  check($_, optional => 1) for @SL::InstallationCheck::optional_modules;
34 46
}
35
if ($d) {
47
if ($check{d}) {
36 48
  check($_, devel => 1) for @SL::InstallationCheck::developer_modules;
37 49
}
38 50

  
......
40 52
  my ($module, %role) = @_;
41 53

  
42 54
  my $line = "Looking for $module->{fullname}";
43
  print $line;
44 55
  my $res = SL::InstallationCheck::module_available($module->{"name"}, $module->{version});
45
  print dot_pad(length $line, $res ? 2 : 6, $res ? mycolor("ok", 'green') : mycolor("NOT ok", 'red')), $/;
56
  print_result($line, $res);
46 57

  
47 58
  return if $res;
48 59

  
......
94 105
  return colored(@_);
95 106
}
96 107

  
97
sub dot_pad {
98
  my ($s, $l, $text) = @_;
99
  print " ";
100
  print '.' x (80 - $s - 2 - $l);
101
  print " ";
102
  return $text;
108
sub print_result {
109
  my ($test, $exit) = @_;
110
  print $test, " ", ('.' x (72 - length $test));
111
  print $exit ? '.... '. mycolor('ok', 'green') : ' '. mycolor('NOT ok', 'red');
112
  print "\n";
113
  return;
103 114
}
104 115

  
105 116
1;
......
118 129

  
119 130
=head1 DESCRIPTION
120 131

  
121
List all modules needed by Lx-Office, probes for them, and warns if one is not available.
132
Check dependencys. List all perl modules needed by Lx-Office, probes for them,
133
and warns if one is not available.
134

  
135
=head1 OPTIONS
122 136

  
123 137
=over 4
124 138

  
......
130 144

  
131 145
Color output. Default on.
132 146

  
147
=item C<--no-color>
148

  
149
No color output. Helpful to avoid terminal escape problems.
150

  
133 151
=item C<-d, --devel>
134 152

  
135 153
Probe for developer dependancies. (Used for console  and tags file)
136 154

  
155
=item C<--no-devel>
156

  
157
Dont't probe for developer dependancies. (Useful in combination with --all)
158

  
137 159
=item C<-h, --help>
138 160

  
139 161
Display this help.
......
142 164

  
143 165
Probe for optional modules.
144 166

  
167
=item C<--no-optional>
168

  
169
Dont't probe for optional modules. (Useful in combination with --all)
170

  
145 171
=item C<-r, --required>
146 172

  
147 173
Probe for required modules (default).
148 174

  
175
=item C<--no-required>
176

  
177
Dont't probe for required modules. (Useful in combination with --all)
178

  
149 179
=item C<-v. --verbose>
150 180

  
151
Print additional info for modules that are missing
181
Print additional info for missing dependancies
152 182

  
153 183
=back
154 184

  
......
178 208

  
179 209
  Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
180 210
  Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
211
  Wulf Coulmann E<lt>wulf@coulmann.deE<gt>
181 212

  
182 213
=cut

Auch abrufbar als: Unified diff