summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorOliver Tappe2008-05-26 21:22:00 +0200
committerOliver Tappe2008-05-26 21:22:00 +0200
commitb943b09340c3e3c59f83823946ceeb3e453b3e52 (patch)
treecfbb91e9b11a909b3ffc785cb9c18fc68a06d1fc /os-plugins
parentFixed non-working installation & deinstallation of plugins into/from the '<<<... (diff)
downloadcore-b943b09340c3e3c59f83823946ceeb3e453b3e52.tar.gz
core-b943b09340c3e3c59f83823946ceeb3e453b3e52.tar.xz
core-b943b09340c3e3c59f83823946ceeb3e453b3e52.zip
* reworked plugin-API concerning the way the parameters are passed into
installationPhase() and removalPhase() - now we use a hash as the amount of parameters has become too large * adjusted all plugins to these API change * now not only the openslx base path, but the openslx config path is bind mounted into the vendor-OS chroot, such that plugins can check the available local configuration extensions git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1803 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Base.pm68
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm68
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm125
-rw-r--r--os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm43
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm15
-rw-r--r--os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm49
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm26
-rw-r--r--os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm48
8 files changed, 238 insertions, 204 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm
index a07ec125..5c8f4e6c 100644
--- a/os-plugins/OpenSLX/OSPlugin/Base.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Base.pm
@@ -225,22 +225,47 @@ a file from the OpenSLX host installation into the vendor-OS, while others may
need to download files from the internet and/or install packages through the
vendor-OS' meta packager.
-N.B.: This method is invoked while chrooted into the vendor-OS root. In order to
-make the OpenSLX files from the host available, the OpenSLX base folder
-(normally /opt/openslx) will be mounted to /mnt/openslx. So if you have to copy
-any files from the host, fetch them from there.
+N.B.: This method is invoked while chrooted into the vendor-OS root.
+
+The hash-ref given in B<$info> contains vital information for the installation
+process:
+
+=over
+
+=item C<plugin-repo-path>
+
+The folder where the stage1-plugin should store all files required by the
+corresponding stage3 runlevel script.
+
+=item C<plugin-temp-path>
+
+A temporary playground that will be cleaned up automatically.
+
+=item C<openslx-base-path>
+
+In order to make the OpenSLX files from the host available, the OpenSLX base
+folder (normally /opt/openslx) will be mounted into the chroot.
+So if you have to copy any files from the host, fetch them from this path.
+
+=item C<openslx-config-path>
+
+In order to make the OpenSLX config files from the host available, the OpenSLX
+config folder (normally /etc/opt/openslx) will be mounted into the chroot.
+So if you have to copy any config files from the host, fetch them from this
+path.
+
+=item C<plugin-attrs>
+
+Contains the attributes in effect for the installation of this plugin.
+
+=back
=cut
sub installationPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
+ my $info = shift;
return;
}
@@ -255,17 +280,28 @@ the vendor-OS' meta packager.
N.B.: This method is invoked while chrooted into the vendor-OS root.
+The hash-ref given in B<$info> contains vital information for the installation
+process:
+
+=over
+
+=item C<plugin-repo-path>
+
+The folder where the stage1-plugin should store all files required by the
+corresponding stage3 runlevel script.
+
+=item C<plugin-temp-path>
+
+A temporary playground that will be cleaned up automatically.
+
+=back
+
=cut
sub removalPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
+ my $info = shift;
return;
}
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index 8527e827..6db265e9 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -94,7 +94,8 @@ sub initialize
= "/tmp/slx-plugin/$self->{'plugin-name'}";
$self->{'plugin-temp-path'}
= "$self->{'vendor-os-path'}/$self->{'chrooted-plugin-temp-path'}";
- $self->{'chrooted-openslx-base-path'} = '/mnt/openslx';
+ $self->{'chrooted-openslx-base-path'} = '/mnt/opt/openslx';
+ $self->{'chrooted-openslx-config-path'} = '/mnt/etc/opt/openslx';
# check and store given attribute set
my $knownAttrs = $self->{plugin}->getAttrInfo();
@@ -168,12 +169,18 @@ sub installPlugin
$self->_callChrootedFunctionForPlugin(
sub {
# invoke plugin and let it install itself into vendor-OS
- $self->{plugin}->installationPhase(
- $self->{'chrooted-plugin-repo-path'},
- $self->{'chrooted-plugin-temp-path'},
- $self->{'chrooted-openslx-base-path'},
- $self->{'plugin-attrs'},
- );
+ $self->{plugin}->installationPhase( {
+ 'plugin-repo-path'
+ => $self->{'chrooted-plugin-repo-path'},
+ 'plugin-temp-path'
+ => $self->{'chrooted-plugin-temp-path'},
+ 'openslx-base-path'
+ => $self->{'chrooted-openslx-base-path'},
+ 'openslx-config-path'
+ => $self->{'chrooted-openslx-config-path'},
+ 'plugin-attrs'
+ => $self->{'plugin-attrs'},
+ } );
# serialize possibly changed attributes (executed inside chroot)
store $self->{'plugin-attrs'}, $chrootedSerializedAttrsFile;
@@ -208,11 +215,18 @@ sub removePlugin
$self->_callChrootedFunctionForPlugin(
sub {
- $self->{plugin}->removalPhase(
- $self->{'chrooted-plugin-repo-path'},
- $self->{'chrooted-plugin-temp-path'},
- $self->{'chrooted-openslx-base-path'},
- );
+ $self->{plugin}->removalPhase( {
+ 'plugin-repo-path'
+ => $self->{'chrooted-plugin-repo-path'},
+ 'plugin-temp-path'
+ => $self->{'chrooted-plugin-temp-path'},
+ 'openslx-base-path'
+ => $self->{'chrooted-openslx-base-path'},
+ 'openslx-config-path'
+ => $self->{'chrooted-openslx-config-path'},
+ 'plugin-attrs'
+ => $self->{'plugin-attrs'},
+ } );
}
);
@@ -550,25 +564,39 @@ sub _callChrootedFunctionForPlugin
my $function = shift;
# bind-mount openslx basepath to /mnt/openslx of vendor-OS:
- my $basePath = $openslxConfig{'base-path'};
- my $openslxPathInChroot = "$self->{'vendor-os-path'}/mnt/openslx";
- mkpath($openslxPathInChroot);
+ 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);
my $pluginSession = OpenSLX::ScopedResource->new({
name => 'osplugin::session',
acquire => sub {
- # bind mount openslx base path into vendor-OS
- slxsystem("mount -o bind -o ro $basePath $openslxPathInChroot") == 0
+ # bind mount openslx base and config paths into vendor-OS
+ slxsystem("mount -o bind -o ro $basePath $basePathInChroot") == 0
or die _tr(
"unable to bind mount '%s' to '%s'! (%s)",
- $basePath, $openslxPathInChroot, $!
+ $basePath, $basePathInChroot, $!
+ );
+ slxsystem(
+ "mount -o bind -o ro $configPath $configPathInChroot"
+ ) == 0
+ or die _tr(
+ "unable to bind mount '%s' to '%s'! (%s)",
+ $configPath, $configPathInChroot, $!
);
1
},
release => sub {
- slxsystem("umount $openslxPathInChroot") == 0
+ slxsystem("umount $basePathInChroot") == 0
+ or die _tr(
+ "unable to umount '%s'! (%s)", $basePathInChroot, $!
+ );
+ slxsystem("umount $configPathInChroot") == 0
or die _tr(
- "unable to umount '%s'! (%s)", $openslxPathInChroot, $!
+ "unable to umount '%s'! (%s)", $configPathInChroot, $!
);
1
},
diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm
index bfaee875..7f20f852 100644
--- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm
+++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm
@@ -64,24 +64,24 @@ sub getAttrInfo
content_descr => '1 means active - 0 means inactive',
default => '1',
},
- 'desktop::manager' => {
+ 'desktop::kind' => {
applies_to_systems => 1,
applies_to_clients => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- which display manager to start: gdm, kdm or xdm?
+ which desktop environment shall be used: gnome, kde, or xfce?
End-of-Here
- content_regex => qr{^(gdm|kdm|xdm)$},
- content_descr => '"gdm", "kdm" or "xdm"',
+ content_regex => qr{^(gnome|kde|xfce)$},
+ content_descr => '"gnome", "kde" or "xfce"',
default => undef,
},
- 'desktop::kind' => {
+ 'desktop::manager' => {
applies_to_systems => 1,
applies_to_clients => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- which desktop environment shall be used: gnome, kde, or xfce?
+ which display manager to start: gdm, kdm or xdm?
End-of-Here
- content_regex => qr{^(gnome|kde|xfce)$},
- content_descr => '"gnome", "kde" or "xfce"',
+ content_regex => qr{^(gdm|kdm|xdm)$},
+ content_descr => '"gdm", "kdm" or "xdm"',
default => undef,
},
'desktop::mode' => {
@@ -106,15 +106,6 @@ sub getAttrInfo
},
# stage1
- 'desktop::supported_themes' => {
- applies_to_vendor_os => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- name of all themes that shall be installed in vendor-OS (such
- that they can be selected via 'desktop::theme' in stage 3).
- End-of-Here
- content_descr => 'a comma-separated list of theme names',
- default => 'openslx',
- },
'desktop::gdm' => {
applies_to_vendor_os => 1,
description => unshiftHereDoc(<<' End-of-Here'),
@@ -124,37 +115,46 @@ sub getAttrInfo
content_descr => '"0", "1" or "-" (for unset)',
default => undef,
},
- 'desktop::kdm' => {
+ 'desktop::gnome' => {
applies_to_vendor_os => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- should kdm be available (installed in vendor-OS)?
+ should gnome be available (installed in vendor-OS)?
End-of-Here
content_regex => qr{^0|1$},
content_descr => '"0", "1" or "-" (for unset)',
default => undef,
},
- 'desktop::xdm' => {
+ 'desktop::kde' => {
applies_to_vendor_os => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- should xdm be available (installed in vendor-OS)?
+ should kde be available (installed in vendor-OS)?
End-of-Here
content_regex => qr{^0|1$},
content_descr => '"0", "1" or "-" (for unset)',
default => undef,
},
- 'desktop::gnome' => {
+ 'desktop::kdm' => {
applies_to_vendor_os => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- should gnome be available (installed in vendor-OS)?
+ should kdm be available (installed in vendor-OS)?
End-of-Here
content_regex => qr{^0|1$},
content_descr => '"0", "1" or "-" (for unset)',
default => undef,
},
- 'desktop::kde' => {
+ 'desktop::supported_themes' => {
applies_to_vendor_os => 1,
description => unshiftHereDoc(<<' End-of-Here'),
- should kde be available (installed in vendor-OS)?
+ name of all themes that shall be installed in vendor-OS (such
+ that they can be selected via 'desktop::theme' in stage 3).
+ End-of-Here
+ content_descr => 'a comma-separated list of theme names',
+ default => undef,
+ },
+ 'desktop::xdm' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should xdm be available (installed in vendor-OS)?
End-of-Here
content_regex => qr{^0|1$},
content_descr => '"0", "1" or "-" (for unset)',
@@ -314,11 +314,13 @@ sub checkStage3AttrValues
sub installationPhase
{
my $self = shift;
+ my $info = shift;
- $self->{pluginRepositoryPath} = shift;
- $self->{pluginTempPath} = shift;
- $self->{openslxPath} = shift;
- $self->{attrs} = shift;
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
# We are going to change some of the stage1 attributes during installation
# (basically we are filling the ones that are not defined). Since the result
@@ -332,6 +334,7 @@ sub installationPhase
$self->{gnome} = $self->{attrs}->{'desktop::gnome'};
$self->{kde} = $self->{attrs}->{'desktop::kde'};
$self->{xcfe} = $self->{attrs}->{'desktop::xfce'};
+ $self->{supported_themes} = $self->{attrs}->{'desktop::supported_themes'};
$self->_installRequiredPackages();
$self->_fillUnsetStage1Attrs();
@@ -355,9 +358,8 @@ sub installationPhase
sub removalPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
+ my $info = shift;
+
return;
}
@@ -368,40 +370,9 @@ sub copyRequiredFilesIntoInitramfs
my $attrs = shift;
my $makeInitRamFSEngine = shift;
- my $themeDir = "$openslxConfig{'base-path'}/share/themes";
- my $desktopXdmcp = $attrs->{'desktop::xdmcp'} || '';
- my $xdmcpConfigDir
- = "$openslxConfig{'base-path'}/lib/plugins/desktop/files/$desktopXdmcp";
- my $desktopTheme = $attrs->{'desktop::theme'} || '';
- if ($desktopTheme) {
- my $desktopThemeDir
- = "$themeDir/$desktopTheme/desktop/$desktopXdmcp";
- if (-d $desktopThemeDir) {
- $makeInitRamFSEngine->addCMD(
- "mkdir -p $targetPath/usr/share/files"
- );
- $makeInitRamFSEngine->addCMD(
- "mkdir -p $targetPath/usr/share/themes"
- );
- $makeInitRamFSEngine->addCMD(
- "cp -a $desktopThemeDir $targetPath/usr/share/themes/"
- );
- $makeInitRamFSEngine->addCMD(
- "cp -a $xdmcpConfigDir $targetPath/usr/share/files"
- );
- }
- }
- else {
- $desktopTheme = '<none>';
- }
+ my $desktopTheme = $attrs->{'desktop::theme'} || '<none>';
- vlog(
- 1,
- _tr(
- "desktop-plugin: desktop=%s",
- $desktopTheme
- )
- );
+ vlog(1, _tr("desktop-plugin: desktop=%s", $desktopTheme));
return;
}
@@ -456,6 +427,9 @@ sub _fillUnsetStage1Attrs
if (!defined $self->{'xdm'}) {
$self->{'xdm'} = $self->{distro}->isXDMInstalled();
}
+ if (!defined $self->{'supported_themes'}) {
+# $self->{'supported_themes'} = $self->{distro}->getSupportedThemes();
+ }
return 1;
}
@@ -474,7 +448,7 @@ sub _ensureSensibleStage3Attrs
"no desktop kind is possible, plugin 'desktop' wouldn't work!"
);
}
- print _tr("selecting %s as desktop kind\n", $desktops[0]);
+ vlog(0, _tr("selecting %s as desktop kind\n", $desktops[0]));
$self->{attrs}->{'desktop::kind'} = $desktops[0];
}
@@ -488,10 +462,25 @@ sub _ensureSensibleStage3Attrs
"no desktop manager is possible, plugin 'desktop' wouldn't work!"
);
}
- print _tr("selecting %s as desktop manager\n", $managers[0]);
+ vlog(0, _tr("selecting %s as desktop manager\n", $managers[0]));
$self->{attrs}->{'desktop::manager'} = $managers[0];
}
+ # check if current theme is supported at all and select another one, if it
+ # isn't
+ my $theme = $self->{attrs}->{'desktop::theme'} || '';
+ my @supportedThemes = split ",", $self->{'supported_themes'} || '';
+ if (!grep { $_ eq $theme } @supportedThemes) {
+ if (!@supportedThemes) {
+ vlog( 0, _tr("no themes are supported, using no theme!"));
+ $self->{attrs}->{'desktop::theme'} = undef;
+ }
+ else {
+ vlog(0, _tr("selecting %s as theme\n", $supportedThemes[0]));
+ $self->{attrs}->{'desktop::theme'} = $supportedThemes[0];
+ }
+ }
+
return 1;
}
@@ -603,7 +592,7 @@ sub _setupSupportedThemes
my @supportedThemes = split m{\s*,\s*}, $supportedThemes;
return if !@supportedThemes;
- my $themeBaseDir = "$self->{openslxPath}/lib/plugins/desktop/themes";
+ my $themeBaseDir = "$self->{openslxBasePath}/lib/plugins/desktop/themes";
THEME:
for my $theme (@supportedThemes) {
my $themeDir = "$themeBaseDir/$theme";
diff --git a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
index ae7bb4ef..6228ed5d 100644
--- a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
+++ b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
@@ -89,41 +89,45 @@ sub installationPhase
{ # called while chrooted to the vendor-OS root in order to give the plugin
# a chance to install required files into the vendor-OS.
my $self = shift;
+ my $info = shift;
- my $pluginRepositoryPath = shift;
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
# The folder where the stage1-plugin should store all files
# required by the corresponding stage3 runlevel script.
# As this method is being executed while chrooted into the vendor-OS,
# this path is relative to that root (i.e. directly usable).
- my $pluginTempPath = shift;
+ my $pluginTempPath = $info->{'plugin-temp-path'};
# A temporary playground that will be cleaned up automatically.
# As this method is being executed while chrooted into the vendor-OS,
# this path is relative to that root (i.e. directly usable).
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ # the openslx base path (/opt/openslx) bind-mounted into the chroot
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ # the openslx config path (/etc/opt/openlsx) bind-mounted into the
+ # chroot
+ my $attrs = $info->{'plugin-attrs'};
+ # attributes in effect for this installation
# for this example plugin, we simply create two files:
- spitFile("$pluginRepositoryPath/right", "(-;\n");
- spitFile("$pluginRepositoryPath/left", ";-)\n");
+ spitFile("$pluginRepoPath/right", "(-;\n");
+ spitFile("$pluginRepoPath/left", ";-)\n");
# Some plugins have to copy files from their plugin folder into the
- # vendor-OS. In order to make this possible while chrooted, the host's
- # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS.
- # So each plugin could copy some files like this:
+ # vendor-OS. Here's an example for how to do that:
#
# # get our own name:
# my $pluginName = $self->{'name'};
#
# # get our own base path:
- # my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName";
+ # my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName";
#
# # copy all needed files now:
# foreach my $file ( qw( file1, file2 ) ) {
- # copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/");
+ # copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
# }
# name of current os
- # $self->{'os-plugin-engine'}->{'vendor-os-name'}
+ # my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'}
return;
}
@@ -132,10 +136,17 @@ sub removalPhase
{ # called while chrooted to the vendor-OS root in order to give the plugin
# a chance to uninstall no longer required files from the vendor-OS.
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
return;
}
diff --git a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
index e5e63c29..6e810869 100644
--- a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
+++ b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
@@ -108,11 +108,13 @@ sub getAttrInfo
sub installationPhase
{
my $self = shift;
+ my $info = shift;
- $self->{pluginRepositoryPath} = shift;
- $self->{pluginTempPath} = shift;
- $self->{openslxPath} = shift;
- $self->{attrs} = shift;
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
# We are going to change some of the stage1 attributes during installation
# (basically we are filling the ones that are not defined). Since the result
@@ -167,9 +169,8 @@ die 'sorry, support for kind "syslogd" is not implemented yet!';
sub removalPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
+ my $info = shift;
+
return;
}
diff --git a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
index 778e419c..2db3c315 100644
--- a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
+++ b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
@@ -65,56 +65,27 @@ sub getAttrInfo
sub installationPhase
-{ # called while chrooted to the vendor-OS root in order to give the plugin
- # a chance to install required files into the vendor-OS.
+{
my $self = shift;
+ my $info = shift;
- my $pluginRepositoryPath = shift;
- # The folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script.
- # As this method is being executed while chrooted into the vendor-OS,
- # this path is relative to that root (i.e. directly usable).
- my $pluginTempPath = shift;
- # A temporary playground that will be cleaned up automatically.
- # As this method is being executed while chrooted into the vendor-OS,
- # this path is relative to that root (i.e. directly usable).
- my $openslxPath = shift;
- # the openslx base path bind-mounted into the chroot (/mnt/openslx)
-
- # for this example plugin, we simply create two files:
- #spitFile("$pluginRepositoryPath/right", "(-;\n");
- #spitFile("$pluginRepositoryPath/left", ";-)\n");
-
- # Some plugins have to copy files from their plugin folder into the
- # vendor-OS. In order to make this possible while chrooted, the host's
- # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS.
- # get our own name:
- my $pluginName = $self->{'name'};
-
-
- # get our own base path:
- my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName/files";
-
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
# copy all needed files now:
- #system( "bash") ;
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
foreach my $file ( qw( vmchooser ) ) {
- copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/");
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
}
- # name of current os
- # $self->{'os-plugin-engine'}->{'vendor-os-name'}
-
return;
}
sub removalPhase
-{ # called while chrooted to the vendor-OS root in order to give the plugin
- # a chance to uninstall no longer required files from the vendor-OS.
+{
my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, relative to the vendor-OS root
- my $pluginTempPath = shift;
- # the temporary folder, relative to the vendor-OS root
+ my $info = shift;
return;
}
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 16dfe520..e04aed0b 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -171,12 +171,14 @@ sub getAttrInfo
sub installationPhase
{
- my $self = shift;
-
- $self->{pluginRepositoryPath} = shift;
- $self->{pluginTempPath} = shift;
- $self->{openslxPath} = shift;
- $self->{attrs} = shift;
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
# kinds we will configure and install
@@ -194,11 +196,9 @@ sub installationPhase
sub removalPhase
{
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
- rmtree ( [ $pluginRepositoryPath ] );
+ my $self = shift;
+ my $info = shift;
+
# restore old start scripts - to be discussed
my @files = qw( vmware vmplayer );
foreach my $file (@files) {
@@ -314,7 +314,7 @@ sub _localInstallation
my $vmbuildversion = "";
my $pluginFilesPath
- = "$self->{'openslxPath'}/lib/plugins/$self->{'name'}/files";
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
mkpath($installationPath);
@@ -410,7 +410,7 @@ sub _vmpl2Installation {
my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
my $pluginFilesPath
- = "$self->{'openslxPath'}/lib/plugins/$self->{'name'}/files";
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
mkpath($installationPath);
diff --git a/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
index 16bf4fe1..37dc14bd 100644
--- a/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
+++ b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
@@ -176,40 +176,39 @@ sub getAttrInfo
sub installationPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
- my $openslxPath = shift;
+ my $info = shift;
+
+ my $pluginRepositoryPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
# get path of files we need to install
- my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files";
+ my $pluginFilesPath = "$openslxBasePath/lib/plugins/$self->{'name'}/files";
# copy all needed files now
copyFile("$pluginFilesPath/x11vnc", "/etc/init.d");
vlog(3, "install init file");
if ( !-x "/usr/bin/x11vnc" ) {
- # let's install x11vnc
- if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/(debian|ubuntu)/i ) {
- my $cmd = "aptitude -y install x11vnc";
- vlog(3, "executing: $cmd");
- if (slxsystem($cmd)) {
- die _tr(
- "unable to execute shell-cmd\n\t%s", $cmd
- );
+ # let's install x11vnc
+ my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'};
+ if ( $vendorOSName =~ m/(debian|ubuntu)/i ) {
+ my $cmd = "aptitude -y install x11vnc";
+ vlog(3, "executing: $cmd");
+ if (slxsystem($cmd)) {
+ die _tr("unable to execute shell-cmd\n\t%s", $cmd);
+ }
}
- }
- if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/suse/i ) {
- # PLEASE TEST THIS!!!
- my $cmd = "zypper -n in x11vnc";
- vlog(3, "executing: $cmd");
- if (slxsystem($cmd)) {
- die _tr(
- "unable to execute shell-cmd\n\t%s", $cmd
- );
+ if ( $vendorOSName =~ m/suse/i ) {
+ # PLEASE TEST THIS!!!
+ my $cmd = "zypper -n in x11vnc";
+ vlog(3, "executing: $cmd");
+ if (slxsystem($cmd)) {
+ die _tr("unable to execute shell-cmd\n\t%s", $cmd);
+ }
}
- }
} else {
- vlog(3, "x11vnc is already installed");
+ vlog(3, "x11vnc is already installed");
}
}
@@ -217,8 +216,7 @@ sub installationPhase
sub removalPhase
{
my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
+ my $info = shift;
}
1;