Ein Script, das momentan nur überprüft, ob alle benötigten Perl-Module installiert...
[kivitendo-erp.git] / scripts / installation_check.pl
1 #!/usr/bin/perl -w
2
3 $| = 1;
4
5 my @required_modules = (
6   { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
7   { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
8   { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" },
9   { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" },
10   { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" },
11   { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" },
12   { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" },
13   { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" },
14   );
15
16 sub module_available {
17   my ($module) = @_;
18
19   if (!defined(eval("require $module;"))) {
20     return 0;
21   } else {
22     return 1;
23   }
24 }
25
26 foreach my $module (@required_modules) {
27   print("Looking for $module->{name}...");
28   if (!module_available($module->{"name"})) {
29     print(" NOT found\n" .
30           "  The module '$module->{name}' is not available on your system.\n" .
31           "  Please install it with the CPAN shell, e.g.\n" .
32           "    perl -MCPAN -e install \"install $module->{name}\"\n" .
33           "  or download it from this URL and install it manually:\n" .
34           "    $module->{url}\n\n");
35   } else {
36     print(" ok\n");
37   }
38 }