From 0e2a54e0dc20a5d4f90ebdf31ba243fb9aaf191b Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 23 Mar 2007 09:51:21 +0000 Subject: * added support for cloning distros for which no specific module exists yet (like will probably be the case for Gentoo for a long time). git-svn-id: http://svn.openslx.org/svn/openslx/trunk@805 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Distro/Any_Clone.pm | 31 +++++++++++++++++++++++++++ installer/OpenSLX/OSSetup/Engine.pm | 27 +++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 installer/OpenSLX/OSSetup/Distro/Any_Clone.pm (limited to 'installer/OpenSLX') diff --git a/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm new file mode 100644 index 00000000..7602870d --- /dev/null +++ b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm @@ -0,0 +1,31 @@ +# Any_Clone.pm +# - provides generic clone-only overrides of the OpenSLX OSSetup API. +# +# (c) 2006 - OpenSLX.com +# +# Oliver Tappe +# +package OpenSLX::OSSetup::Distro::Any_Clone; + +use vars qw(@ISA $VERSION); +@ISA = ('OpenSLX::OSSetup::Distro::Base'); +$VERSION = 1.01; # API-version . implementation-version + +use strict; +use Carp; +use OpenSLX::Basics; +use OpenSLX::OSSetup::Distro::Base 1.01; + +################################################################################ +### implementation +################################################################################ +sub new +{ + my $class = shift; + my $self = { + 'base-name' => 'any-clone', + }; + return bless $self, $class; +} + +1; \ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index ff266e66..6e89fccb 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -104,6 +104,12 @@ sub initialize my $distroModule = "OpenSLX::OSSetup::Distro::" .$supportedDistros{lc($distroName)}->{module}; + if ($actionType eq 'clone') { + # fallback to generic clone module, such that we can clone + # distro's for which there is no specific distro-module yet + # (like for example for Gentoo): + $distroModule = "OpenSLX::OSSetup::Distro::Any_Clone"; + } unless (eval "require $distroModule") { if ($! == 2) { die _tr("Distro-module <%s> not found!\n", $distroModule); @@ -120,13 +126,15 @@ sub initialize $distro->initialize($self); $self->{distro} = $distro; - # setup path to distribution-specific info: - my $distroInfoDir = "../lib/distro-info/$distro->{'base-name'}"; - if (!-d $distroInfoDir) { - die _tr("unable to find distro-info for distro '%s'\n", $distro->{'base-name'}); + if ($actionType ne 'clone') { + # setup path to distribution-specific info: + my $distroInfoDir = "../lib/distro-info/$distro->{'base-name'}"; + if (!-d $distroInfoDir) { + die _tr("unable to find distro-info for distro '%s'\n", $distro->{'base-name'}); + } + $self->{'distro-info-dir'} = $distroInfoDir; + $self->readDistroInfo(); } - $self->{'distro-info-dir'} = $distroInfoDir; - $self->readDistroInfo(); if (!$self->{'action-type'} eq 'install' && !exists $self->{'distro-info'}->{'selection'}->{$selectionName}) { @@ -141,9 +149,10 @@ sub initialize = "$openslxConfig{'stage1-path'}/$self->{'vendor-os-name'}"; vlog 1, "vendor-OS will be installed to '$self-vendor-os-path'}'"; - $self->createPackager(); - $self->createMetaPackager(); - + if ($actionType ne 'clone') { + $self->createPackager(); + $self->createMetaPackager(); + } } sub installVendorOS -- cgit v1.2.3-55-g7522