diff options
author | Oliver Tappe | 2008-07-25 15:10:30 +0200 |
---|---|---|
committer | Oliver Tappe | 2008-07-25 15:10:30 +0200 |
commit | b621c2a597d3c13dde98d8a089376e4d878ca811 (patch) | |
tree | 9d26b5edb55a7ed57aa47b95369b81417a5a74be | |
parent | * added missing dependency declaration from 'vmware' plugin to 'desktop', (diff) | |
download | core-b621c2a597d3c13dde98d8a089376e4d878ca811.tar.gz core-b621c2a597d3c13dde98d8a089376e4d878ca811.tar.xz core-b621c2a597d3c13dde98d8a089376e4d878ca811.zip |
closing ticket #241:
* support for plugin-hooks preInstallationPhase() and postRemovalPhase() has
been (re-)introduced, such that each plugin has a chance to copy files
into/from the chroot
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1939 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Base.pm | 132 | ||||
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 20 |
2 files changed, 152 insertions, 0 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm index 734a74f5..a118e79b 100644 --- a/os-plugins/OpenSLX/OSPlugin/Base.pm +++ b/os-plugins/OpenSLX/OSPlugin/Base.pm @@ -318,6 +318,23 @@ corresponding stage3 runlevel script. 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 @@ -330,6 +347,121 @@ sub removalPhase return; } +=item preInstallationPhase() + +In this method, any preparations for installation of the plugin into a vendor-OS +should be executed. As this method is being called immediately before the chroot +is entered, this is the last/only chance to copy any files into the chroot that +are required from within (in installationPhase()). + +The given parameters are similar to the ones for installationPhase(), except +that all paths are now relative to the root-fs instead of being relative to the +chroot (i.e. the paths are ready to be used from outside the chroot): + +=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. + +If a plugin needs to unpack any archives, these archives should be copied to +this folder (as it will be cleaned 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. + +=item C<vendor-os-path> + +Contains the path to the vendor-OS into which the plugin will be installed. + +=back + +=cut + +sub preInstallationPhase +{ + my $self = shift; + my $info = shift; + + return; +} + +=item postRemovalPhase() + +In this method, any plugin has the chance to do any necessary cleanup that +must be executed outside of the chroot. + +This method is invoked immediately after leaving the chroot into the vendor-OS +root, but before the plugin-temp-path has been cleaned up. So if required, any +files could be copied out of the temp-path somewhere into the root-fs. + +The given parameters are similar to the ones for removalPhase(), except that all +paths are now relative to the root-fs instead of being relative to the chroot +(i.e. the paths are ready to be used from outside the chroot): + +=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. + +=item C<vendor-os-path> + +Contains the path to the vendor-OS from which the plugin has been removed. + +=back + +=cut + +sub postRemovalPhase +{ + my $self = shift; + my $info = shift; + + return; +} + =back =head2 Initramfs Interface diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index ae76c9e0..09265f8f 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -169,6 +169,16 @@ sub installPlugin # missing modules). store $self->{'plugin-attrs'}, $serializedAttrsFile; + # invoke plugin and let it prepare the installation + $self->{plugin}->preInstallationPhase( { + 'plugin-repo-path' => $self->{'plugin-repo-path'}, + 'plugin-temp-path' => $self->{'plugin-temp-path'}, + 'openslx-base-path' => $openslxConfig{'base-path'}, + 'openslx-config-path' => $openslxConfig{'config-path'}, + 'plugin-attrs' => $self->{'plugin-attrs'}, + 'vendor-os-path' => $self->{'vendor-os-path'}, + } ); + $self->_callChrootedFunctionForPlugin( sub { # invoke plugin and let it install itself into vendor-OS @@ -235,6 +245,16 @@ sub removePlugin } ); + # invoke plugin and let it prepare the installation + $self->{plugin}->postRemovalPhase( { + 'plugin-repo-path' => $self->{'plugin-repo-path'}, + 'plugin-temp-path' => $self->{'plugin-temp-path'}, + 'openslx-base-path' => $openslxConfig{'base-path'}, + 'openslx-config-path' => $openslxConfig{'config-path'}, + 'plugin-attrs' => $self->{'plugin-attrs'}, + 'vendor-os-path' => $self->{'vendor-os-path'}, + } ); + rmtree([ $self->{'plugin-repo-path'}, $self->{'plugin-temp-path'} ]); } |