summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/OpenSLX/Basics.pm6
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm33
2 files changed, 30 insertions, 9 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 581e6e49..ca6dd9fb 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -48,14 +48,8 @@ use open ':utf8';
require Carp; # do not import anything as we are going to overload carp
# and croak!
-use Carp::Heavy; # use it here to have it loaded immediately, not at
- # the time when carp() is being invoked (which might
- # be at a point in time where the script executes in
- # a chrooted environment, such that the module can't
- # be loaded anymore).
use Config::General;
use Encode;
-require File::Glob;
use FindBin;
use Getopt::Long;
use POSIX qw(locale_h);
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index c5e6a99f..112a7683 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -18,6 +18,7 @@ use warnings;
our $VERSION = 1.01; # API-version . implementation-version
+use Config;
use File::Basename;
use File::Path;
use Storable;
@@ -631,13 +632,18 @@ sub _callChrootedFunctionForPlugin
# via other processes (which could cause problems)
my $osSetupEngine = $self->_osSetupEngine();
- # bind-mount openslx basepath to /mnt/openslx of vendor-OS:
+ # prepare bind-mount of openslx base and config paths to /mnt of
+ # vendor-OS:
my $basePath = $openslxConfig{'base-path'};
my $basePathInChroot = "$self->{'vendor-os-path'}/mnt/opt/openslx";
mkpath($basePathInChroot);
my $configPath = $openslxConfig{'config-path'};
my $configPathInChroot = "$self->{'vendor-os-path'}/mnt/etc/opt/openslx";
mkpath($configPathInChroot);
+ # prepare bind-mount of host's perl corelib path to /mnt of vendor-OS:
+ my $hostPerlCorePath = $Config{privlibexp};
+ my $hostPerlCorePathInChroot = "$self->{'vendor-os-path'}/mnt/host-perl";
+ mkpath($hostPerlCorePathInChroot);
my $pluginSession = OpenSLX::ScopedResource->new({
name => 'osplugin::session',
@@ -655,17 +661,38 @@ sub _callChrootedFunctionForPlugin
"unable to bind mount '%s' to '%s'! (%s)",
$configPath, $configPathInChroot, $!
);
+ # Bind mount hosts perl core path into vendor-OS and add it to
+ # perl's search paths, in order to let dynamic loading of perl
+ # modules/scripts work. Currently, we hope that only the perl core
+ # path (privlibexp) is required for that, but we might have to
+ # mount the architecture dependent path (archlibexp) or the
+ # vendor perl paths (vendorlibexp and vendorarchexp), too.
+ slxsystem(
+ "mount -o bind -o ro $hostPerlCorePath $hostPerlCorePathInChroot"
+ ) == 0
+ or die _tr(
+ "unable to bind mount '%s' to '%s'! (%s)",
+ $hostPerlCorePath, $hostPerlCorePathInChroot, $!
+ );
+ unshift @INC, '/mnt/host-perl';
1
},
release => sub {
- slxsystem("umount $basePathInChroot") == 0
+ if ($INC[0] eq '/mnt/host-perl') {
+ shift @INC;
+ }
+ slxsystem("umount $hostPerlCorePathInChroot") == 0
or die _tr(
- "unable to umount '%s'! (%s)", $basePathInChroot, $!
+ "unable to umount '%s'! (%s)", $hostPerlCorePathInChroot, $!
);
slxsystem("umount $configPathInChroot") == 0
or die _tr(
"unable to umount '%s'! (%s)", $configPathInChroot, $!
);
+ slxsystem("umount $basePathInChroot") == 0
+ or die _tr(
+ "unable to umount '%s'! (%s)", $basePathInChroot, $!
+ );
1
},
});