- 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.
@optional_modules = (
{ name => "Digest::SHA", url => "http://search.cpan.org/~mshelor/", debian => 'libdigest-sha-perl' },
+ { name => "IO::Socket::SSL", url => "http://search.cpan.org/~sullr/", debian => 'libio-socket-ssl-perl' },
+ { name => "Net::LDAP", url => "http://search.cpan.org/~gbarr/", debian => 'libnet-ldap-perl' },
);
@developer_modules = (
sub check_for_conditional_dependencies {
return if $conditional_dependencies{net_ldap}++;
- push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
+ push @required_modules, grep { $_->{name} eq 'Net::LDAP' } @optional_modules
if $::lx_office_conf{authentication} && ($::lx_office_conf{authentication}->{module} eq 'LDAP');
}
use strict;
-use Config::Std;
-use Encode;
-
my $environment_initialized;
+sub safe_require {
+ my ($class, $may_fail);
+ my $failed;
+ $failed = !eval {
+ require Config::Std;
+ require Encode;
+ };
+
+ if ($failed) {
+ if ($may_fail) {
+ warn $@;
+ return 0;
+ } else {
+ die $@;
+ }
+ }
+
+ Config::Std->import;
+ Encode->import;
+
+ return 1;
+}
+
sub read {
- my ($class, $file_name) = @_;
+ my ($class, $file_name, $may_fail) = @_;
- read_config 'config/lx_office.conf.default' => %::lx_office_conf;
+ return unless $class->safe_require($may_fail);
+
+ read_config('config/lx_office.conf.default' => \%::lx_office_conf);
_decode_recursively(\%::lx_office_conf);
$file_name ||= 'config/lx_office.conf';
if (-f $file_name) {
- read_config $file_name => my %local_conf;
+ read_config($file_name => \ my %local_conf);
_decode_recursively(\%local_conf);
_flat_merge(\%::lx_office_conf, \%local_conf);
}
_init_environment();
_determine_application_paths();
+
+ return 1;
}
sub _decode_recursively {
}
use SL::InstallationCheck;
+use SL::LxOfficeConf;
my %check;
Getopt::Long::Configure ("bundling");
$| = 1;
+if (!SL::LxOfficeConf->read(undef, 'may fail')) {
+ 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.')
+} else {
+ SL::InstallationCheck::check_for_conditional_dependencies();
+}
+
if ($check{r}) {
print_header('Checking Required Modules');
check_module($_, required => 1) for @SL::InstallationCheck::required_modules;