From e642bca01a3a9d2c38e1a42cb7a4a9cadb5af7d7 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 13 Feb 2008 21:07:28 +0000 Subject: * actually activated the removal of a plugin in OSPlugin engine git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1541 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/OpenSLX/OSPlugin/Engine.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'os-plugins') diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index fe2bf1ac..b96673fb 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -106,6 +106,40 @@ sub getPlugin sub removePlugin { + my $self = shift; + + # create ossetup-engine for given vendor-OS: + my $osSetupEngine = OpenSLX::OSSetup::Engine->new; + $osSetupEngine->initialize($self->{'vendor-os-name'}, 'plugin'); + $self->{'os-setup-engine'} = $osSetupEngine; + $self->{'distro-name'} = $osSetupEngine->{'distro-name'}; + + my $chrootedPluginRepoPath + = "$openslxConfig{'base-path'}/plugin-repo/$self->{'plugin-name'}"; + my $pluginRepoPath = "$self->{'vendor-os-path'}/$chrootedPluginRepoPath"; + my $chrootedPluginTempPath = "/tmp/slx-plugin/$self->{'plugin-name'}"; + my $pluginTempPath = "$self->{'vendor-os-path'}/$chrootedPluginTempPath"; + foreach my $path ($pluginRepoPath, $pluginTempPath) { + if (slxsystem("mkdir -p $path")) { + croak(_tr("unable to create path '%s'! (%s)", $path, $!)); + } + } + + $self->{plugin}->preRemovalPhase($pluginRepoPath, $pluginTempPath); + + $self->{'os-setup-engine'}->callChrootedFunctionForVendorOS( + sub { + $self->{plugin}->removalPhase( + $chrootedPluginRepoPath, $chrootedPluginTempPath + ); + } + ); + + $self->{plugin}->postRemovalPhase($pluginRepoPath, $pluginTempPath); + + $self->_removeInstalledPluginFromDB(); + + return 1; } sub _loadPlugin -- cgit v1.2.3-55-g7522