9 unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
10 push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
12 # this is a default dir. may be wrong in your installation, change it then
13 $master_templates = './templates/print/';
16 use SL::InstallationCheck;
19 Getopt::Long::Configure ("bundling");
21 "v|verbose" => \ my $v,
22 "a|all" => \ $check{a},
23 "o|optional!" => \ $check{o},
24 "d|devel!" => \ $check{d},
25 "l|latex!" => \ $check{l},
26 "r|required!" => \ $check{r},
27 "h|help" => sub { pod2usage(-verbose => 2) },
28 "c|color!" => \ ( my $c = 1 ),
31 # if notihing is requested check "required"
32 $check{r} = 1 unless defined $check{a} ||
38 foreach my $check (keys %check) {
39 $check{$check} = 1 unless defined $check{$check};
47 print_header('Checking Required Modules');
48 check_module($_, required => 1) for @SL::InstallationCheck::required_modules;
51 print_header('Checking Optional Modules');
52 check_module($_, optional => 1) for @SL::InstallationCheck::optional_modules;
55 print_header('Checking Developer Modules');
56 check_module($_, devel => 1) for @SL::InstallationCheck::developer_modules;
63 my ($res) = check_kpsewhich();
64 print_result("Looking for LaTeX kpsewhich", $res ? ('ok', 'green') : ('NOT ok', 'red'));
66 check_template_dir($_) for SL::InstallationCheck::template_dirs($master_templates);
70 sub check_template_dir {
72 my $path = $master_templates . $dir;
74 print_header("Checking LaTeX Dependencies for Master Templates '$dir'");
75 kpsewhich($path, 'cls', $_) for SL::InstallationCheck::classes_from_latex($path, '\documentclass');
76 kpsewhich($path, 'sty', $_) for SL::InstallationCheck::classes_from_latex($path, '\usepackage');
79 our $mastertemplate_path = './templates/print/';
82 return 1 if SL::InstallationCheck::check_kpsewhich();
84 print STDERR <<EOL if $v;
85 +------------------------------------------------------------------------------+
86 Can't find kpsewhich, is there a proper installed LaTeX?
87 On Debian you may run "aptitude install texlive-base-bin"
88 +------------------------------------------------------------------------------+
94 my ($dw, $type, $package) = @_;
95 $package =~ s/[^-_0-9A-Za-z]//g;
96 my $type_desc = $type eq 'cls' ? 'document class' : 'package';
98 my $exit = system(qq|TEXINPUTS=".:$dw:" kpsewhich $package.$type > /dev/null|);
99 my $res = $exit > 0 ? 0 : 1;
101 print_result("Looking for LaTeX $type_desc $package", $res);
103 print STDERR <<EOL if $v;
104 +------------------------------------------------------------------------------+
105 LaTeX $type_desc $package could not be loaded.
107 On Debian you may find the needed *.deb package with:
108 apt-file search $package.$type
110 Maybe you need to install apt-file first by:
111 aptitude install apt-file && apt-file update
112 +------------------------------------------------------------------------------+
118 my ($module, %role) = @_;
120 my $line = "Looking for $module->{fullname}";
121 my $res = SL::InstallationCheck::module_available($module->{"name"}, $module->{version});
122 print_result($line, $res);
127 $role{optional} ? 'It is OPTIONAL for Lx-Office but RECOMMENDED for improved functionality.'
128 : $role{required} ? 'It is NEEDED by Lx-Office and must be installed.'
129 : $role{devel} ? 'It is OPTIONAL for Lx-Office and only useful for developers.'
130 : 'It is not listed as a dependancy yet. Please tell this the developers.';
132 my @source_texts = module_source_texts($module);
134 print STDERR <<EOL if $v;
135 +------------------------------------------------------------------------------+
136 $module->{fullname} could not be loaded.
138 This module is either too old or not available on your system.
141 Here are some ideas how to get it:
144 +------------------------------------------------------------------------------+
148 sub module_source_texts {
152 - You can get it from CPAN:
153 perl -MCPAN -e "install $module->{name}"
155 push @texts, <<EOL if $module->{url};
156 - You can download it from this URL and install it manually:
159 push @texts, <<EOL if $module->{debian};
160 - On Debian, Ubuntu and other distros you can install it with apt-get:
161 sudo apt-get install $module->{debian}
162 Note: These may be out of date as well if your system is old.
164 # TODO: SuSE and Fedora packaging. Windows packaging.
170 return $_[0] unless $c;
175 my ($test, $exit) = @_;
176 print $test, " ", ('.' x (72 - length $test));
177 print $exit ? '.... '. mycolor('ok', 'green') : ' '. mycolor('NOT ok', 'red');
195 scripts/installation_check.pl - check Lx-Office dependancies
199 scripts/installation_check.pl [OPTION]
203 Check dependencys. List all perl modules needed by Lx-Office, probes for them,
204 and warns if one is not available. List all LaTeX document classes and
205 packages needed by Lx-Office master templates, probes for them, and warns if
206 one is not available.
215 Probe for all perl modules and all LaTeX master templates.
219 Color output. Default on.
223 No color output. Helpful to avoid terminal escape problems.
227 Probe for perl developer dependancies. (Used for console and tags file)
231 Don't probe for perl developer dependancies. (Useful in combination with --all)
237 =item C<-o, --optional>
239 Probe for optional modules.
241 =item C<--no-optional>
243 Don't probe for optional perl modules. (Useful in combination with --all)
245 =item C<-r, --required>
247 Probe for required perl modules (default).
249 =item C<--no-required>
251 Don't probe for required perl modules. (Useful in combination with --all)
255 Probe for LaTeX documentclasses and packages in master templates.
259 Don't probe for LaTeX document classes and packages in master templates. (Useful in combination with --all)
261 =item C<-v. --verbose>
263 Print additional info for missing dependancies
267 =head1 BUGS, CAVEATS and TODO
273 Fedora packages not listed yet.
277 Not possible yet to generate a combined cpan/apt-get string to install all needed.
281 Not able to handle devel cpan modules yet.
285 Version requirements not fully tested yet.
291 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
292 Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
293 Wulf Coulmann E<lt>wulf@coulmann.deE<gt>