Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ebbabed8

Von Sven Schöling vor fast 11 Jahren hinzugefügt

  • ID ebbabed8bb971d3e17e3188e55310f99429a456f
  • Vorgänger 84326477
  • Nachfolger 0cb0a301

installcheck: apt-get und ähnliche commands mit -i generieren

Unterschiede anzeigen:

scripts/installation_check.pl
4 4
use Getopt::Long;
5 5
use Pod::Usage;
6 6
use Term::ANSIColor;
7
use Text::Wrap;
7 8
our $master_templates;
8 9
BEGIN {
9 10
  unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
......
21 22
  Debian: you may install the needed *.deb package with:
22 23
    apt-get install libconfig-std-perl
23 24

  
24
  RPM: There is a rpm package "perl-Config-Std"
25
  Red Hat/Fedora/CentOS: you may install the needed *.rpm package with:
26
    yum install perl-Config-Std
25 27

  
26
  Suse: you may install the needed *.rpm package with:
28
  SUSE: you may install the needed *.rpm package with:
27 29
    zypper install perl-Config-Std
28 30

  
29 31
+------------------------------------------------------------------------------+
......
35 37
use SL::InstallationCheck;
36 38
use SL::LxOfficeConf;
37 39

  
38

  
40
my @missing_modules;
39 41
my %check;
40 42
Getopt::Long::Configure ("bundling");
41 43
GetOptions(
......
48 50
  "r|required!" => \ $check{r},
49 51
  "h|help"      => sub { pod2usage(-verbose => 2) },
50 52
  "c|color!"    => \ ( my $c = 1 ),
53
  "i|install!"  => \ my $apt,
54
);
55

  
56
my %install_methods = (
57
  apt    => { key => 'debian', install => 'sudo apt-get install', system => "Debian, Ubuntu" },
58
  yum    => { key => 'fedora', install => 'sudo yum install',     system => "RHEL, Fedora, CentOS" },
59
  zypper => { key => 'suse',   install => 'sudo zypper install',  system => "SLES, openSUSE" },
60
  cpan   => { key => 'name',   install => "sudo cpan",            system => "CPAN" },
51 61
);
52 62

  
53 63
# verbos is default
......
101 111
  check_latex();
102 112
}
103 113

  
114
if (@missing_modules && $apt) {
115
  print "\nHere are some sample installation lines, choose one apporpriate for your system:\n\n";
116
  local $Text::Wrap::separator = " \\\n";
117

  
118
  for (keys %install_methods) {
119
    my $method = $install_methods{$_};
120
    if (my @install_candidates = grep $_, map { $_->{$method->{key}} } @missing_modules) {
121
      print "$method->{system}:\n";
122
      print wrap("  ", "    ",  $method->{install}, @install_candidates);
123
      print $/;
124
    }
125
  }
126
}
127

  
104 128
sub check_latex {
105 129
  my ($res) = check_kpsewhich();
106 130
  print_result("Looking for LaTeX kpsewhich", $res);
......
177 201

  
178 202
  return if $res;
179 203

  
204
  push @missing_modules, $module;
205

  
180 206
  my $needed_text =
181 207
      $role{optional} ? 'It is OPTIONAL for kivitendo but RECOMMENDED for improved functionality.'
182 208
    : $role{required} ? 'It is NEEDED by kivitendo and must be installed.'
......
326 352

  
327 353
Disable verbosity
328 354

  
355
=item C<-i, --install>
356

  
357
Tries to generate installation commands for the most common package managers.
358
Note that these lists can be slightly off, but it should still save you a lot
359
of typing.
360

  
329 361
=back
330 362

  
331 363
=head1 BUGS, CAVEATS and TODO

Auch abrufbar als: Unified diff