Revision e3ff1eb6
Von Sven Schöling vor mehr als 12 Jahren hinzugefügt
SL/InstallationCheck.pm | ||
---|---|---|
36 | 36 |
|
37 | 37 |
@optional_modules = ( |
38 | 38 |
{ name => "Digest::SHA", url => "http://search.cpan.org/~mshelor/", debian => 'libdigest-sha-perl' }, |
39 |
{ name => "IO::Socket::SSL", url => "http://search.cpan.org/~sullr/", debian => 'libio-socket-ssl-perl' }, |
|
40 |
{ name => "Net::LDAP", url => "http://search.cpan.org/~gbarr/", debian => 'libnet-ldap-perl' }, |
|
39 | 41 |
); |
40 | 42 |
|
41 | 43 |
@developer_modules = ( |
... | ... | |
97 | 99 |
sub check_for_conditional_dependencies { |
98 | 100 |
return if $conditional_dependencies{net_ldap}++; |
99 | 101 |
|
100 |
push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
|
|
102 |
push @required_modules, grep { $_->{name} eq 'Net::LDAP' } @optional_modules
|
|
101 | 103 |
if $::lx_office_conf{authentication} && ($::lx_office_conf{authentication}->{module} eq 'LDAP'); |
102 | 104 |
} |
103 | 105 |
|
SL/LxOfficeConf.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
5 |
use Config::Std; |
|
6 |
use Encode; |
|
7 |
|
|
8 | 5 |
my $environment_initialized; |
9 | 6 |
|
7 |
sub safe_require { |
|
8 |
my ($class, $may_fail); |
|
9 |
my $failed; |
|
10 |
$failed = !eval { |
|
11 |
require Config::Std; |
|
12 |
require Encode; |
|
13 |
}; |
|
14 |
|
|
15 |
if ($failed) { |
|
16 |
if ($may_fail) { |
|
17 |
warn $@; |
|
18 |
return 0; |
|
19 |
} else { |
|
20 |
die $@; |
|
21 |
} |
|
22 |
} |
|
23 |
|
|
24 |
Config::Std->import; |
|
25 |
Encode->import; |
|
26 |
|
|
27 |
return 1; |
|
28 |
} |
|
29 |
|
|
10 | 30 |
sub read { |
11 |
my ($class, $file_name) = @_; |
|
31 |
my ($class, $file_name, $may_fail) = @_;
|
|
12 | 32 |
|
13 |
read_config 'config/lx_office.conf.default' => %::lx_office_conf; |
|
33 |
return unless $class->safe_require($may_fail); |
|
34 |
|
|
35 |
read_config('config/lx_office.conf.default' => \%::lx_office_conf); |
|
14 | 36 |
_decode_recursively(\%::lx_office_conf); |
15 | 37 |
|
16 | 38 |
$file_name ||= 'config/lx_office.conf'; |
17 | 39 |
|
18 | 40 |
if (-f $file_name) { |
19 |
read_config $file_name => my %local_conf;
|
|
41 |
read_config($file_name => \ my %local_conf);
|
|
20 | 42 |
_decode_recursively(\%local_conf); |
21 | 43 |
_flat_merge(\%::lx_office_conf, \%local_conf); |
22 | 44 |
} |
23 | 45 |
|
24 | 46 |
_init_environment(); |
25 | 47 |
_determine_application_paths(); |
48 |
|
|
49 |
return 1; |
|
26 | 50 |
} |
27 | 51 |
|
28 | 52 |
sub _decode_recursively { |
scripts/installation_check.pl | ||
---|---|---|
14 | 14 |
} |
15 | 15 |
|
16 | 16 |
use SL::InstallationCheck; |
17 |
use SL::LxOfficeConf; |
|
17 | 18 |
|
18 | 19 |
my %check; |
19 | 20 |
Getopt::Long::Configure ("bundling"); |
... | ... | |
47 | 48 |
|
48 | 49 |
$| = 1; |
49 | 50 |
|
51 |
if (!SL::LxOfficeConf->read(undef, 'may fail')) { |
|
52 |
print_header('Could not load the config file. If you have dependancies from any features enabled in the configuration these will still show up as optional because of this. Please rerun this script after installing the dependancies needed to load the cofiguration.') |
|
53 |
} else { |
|
54 |
SL::InstallationCheck::check_for_conditional_dependencies(); |
|
55 |
} |
|
56 |
|
|
50 | 57 |
if ($check{r}) { |
51 | 58 |
print_header('Checking Required Modules'); |
52 | 59 |
check_module($_, required => 1) for @SL::InstallationCheck::required_modules; |
Auch abrufbar als: Unified diff
Bessere Erkennung von optionalen Paketen im Installationscheck
- IO::Socket::SSL wird jetzt als optional geführt.
Wird für LDAP Verbindungen gebraucht wenn TLS benutzt werden soll.
- Wenn Config::Std nicht gefunden wurde, und damit die Konfiguration nicht
eingelesen werden kann, wird Net::LDAP als optional geführt und eine Warnung
ausgegeben, dass evtl nicht aufgelöste Abhängigkeiten existieren.