X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e7fdb1da83751073b7bcc5488772c7e844789062..53e76581596fc6d2caffd950feff42117d1abf96:/scripts/installation_check.pl?ds=inline diff --git a/scripts/installation_check.pl b/scripts/installation_check.pl index 3a81c85f8..1cebcb28e 100755 --- a/scripts/installation_check.pl +++ b/scripts/installation_check.pl @@ -28,12 +28,12 @@ GetOptions( "c|color!" => \ ( my $c = 1 ), ); -# if notihing is requested check "required" +# if nothing is requested check "required" $check{r} = 1 unless defined $check{a} || defined $check{l} || defined $check{o} || defined $check{d}; - +my $default_run ='1' if $check{r}; # no parameter, therefore print a note after default run if ($check{a}) { foreach my $check (keys %check) { $check{$check} = 1 unless defined $check{$check}; @@ -46,6 +46,7 @@ $| = 1; if ($check{r}) { print_header('Checking Required Modules'); check_module($_, required => 1) for @SL::InstallationCheck::required_modules; + print_header('Standard check for required modules done. See additional parameters for more checks (-- help)') if $default_run; } if ($check{o}) { print_header('Checking Optional Modules'); @@ -95,7 +96,12 @@ sub kpsewhich { $package =~ s/[^-_0-9A-Za-z]//g; my $type_desc = $type eq 'cls' ? 'document class' : 'package'; - my $exit = system(qq|TEXINPUTS=".:$dw:" kpsewhich $package.$type > /dev/null|); + eval { use String::ShellQuote; 1 } or warn "can't load String::ShellQuote" && return; + $dw = shell_quote $dw; + my $e_package = shell_quote $package; + my $e_type = shell_quote $type; + + my $exit = system(qq|TEXINPUTS=".:$dw:" kpsewhich $e_package.$e_type > /dev/null|); my $res = $exit > 0 ? 0 : 1; print_result("Looking for LaTeX $type_desc $package", $res); @@ -118,8 +124,13 @@ sub check_module { my ($module, %role) = @_; my $line = "Looking for $module->{fullname}"; - my $res = SL::InstallationCheck::module_available($module->{"name"}, $module->{version}); - print_result($line, $res); + my ($res, $ver) = SL::InstallationCheck::module_available($module->{"name"}, $module->{version}); + if ($res) { + print_line($line, $ver || 'no version', 'green'); + } else { + print_result($line, $res); + } + return if $res; @@ -173,8 +184,17 @@ sub mycolor { sub print_result { my ($test, $exit) = @_; - print $test, " ", ('.' x (72 - length $test)); - print $exit ? '.... '. mycolor('ok', 'green') : ' '. mycolor('NOT ok', 'red'); + if ($exit) { + print_line($test, 'ok', 'green'); + } else { + print_line($test, 'NOT ok', 'red'); + } +} + +sub print_line { + my ($text, $res, $color) = @_; + print $text, " ", ('.' x (78 - length($text) - length($res))); + print mycolor($res, $color); print "\n"; return; }