From c757526e9a9b6923fe4bfb45867368a0010e2417 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 20 Jul 2007 14:18:00 +0000 Subject: * fixed (another) problem when trying to import a vendor-OS that isn't fully supported (which can only be cloned). This time, things work not only for Debian (for which empty Distro-modules exist), but for *all* distributions. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1263 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Engine.pm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'installer') diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index e160377d..5737814b 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -164,17 +164,22 @@ sub initialize } # load module for the requested distro: - my $distroClass; - if ($actionType eq 'clone') { - # force generic clone module, such that we can clone - # distro's for which there is no specific distro-module yet - # (like for example for Gentoo): - $distroClass = "Any_Clone"; + my $distro; + my $distroClass = $supportedDistros{lc($distroName)}->{module}; + if ($actionType =~ m{^(install|update|shell)}) { + $distro = instantiateClass($distroClass); } else { - $distroClass = $supportedDistros{lc($distroName)}->{module}; + if (!eval { + $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass") + }) { + # allow 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): + $distro = instantiateClass("OpenSLX::OSSetup::Distro::Any_Clone") + } } - my $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass"); + $distro->initialize($self); $self->{distro} = $distro; -- cgit v1.2.3-55-g7522