diff options
author | Oliver Tappe | 2008-04-06 15:40:09 +0200 |
---|---|---|
committer | Oliver Tappe | 2008-04-06 15:40:09 +0200 |
commit | 5a8c8a1638eea2ff6897046fcbc94bb42ccbe94d (patch) | |
tree | 036281d5a9b6d847c4bfc92f3c52f96a6ada2df0 /installer | |
parent | * Instead of passing all known attributes of the current system into each plu... (diff) | |
download | core-5a8c8a1638eea2ff6897046fcbc94bb42ccbe94d.tar.gz core-5a8c8a1638eea2ff6897046fcbc94bb42ccbe94d.tar.xz core-5a8c8a1638eea2ff6897046fcbc94bb42ccbe94d.zip |
* made names of distro module consistent across OpenSLX - now the always start with
a capital letter followed by all lowercase (Debian, Fedora, Gentoo, Suse, Ubuntu)
* refactored loading of distro modules into a separate function (loadDistroModule()
in Basics.pm)
* finished support to logging to a file in syslog plugin
* worked at desktop plugin (still not working, though)
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1721 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
18 files changed, 91 insertions, 161 deletions
diff --git a/installer/OpenSLX/OSExport/Distro/Any.pm b/installer/OpenSLX/OSExport/Distro/Any.pm index 59de2f32..b5f46366 100644 --- a/installer/OpenSLX/OSExport/Distro/Any.pm +++ b/installer/OpenSLX/OSExport/Distro/Any.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Any.pm -# - provides generic overrides of the OpenSLX OSExport API. +# OSExport/Distro/Any.pm +# - provides generic overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Any; diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm index b6fc1fae..1b3edb63 100644 --- a/installer/OpenSLX/OSExport/Distro/Base.pm +++ b/installer/OpenSLX/OSExport/Distro/Base.pm @@ -8,9 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Base.pm -# - provides empty base of the distro-specific part of the OpenSLX -# OSExport API. +# OSExport/Distro/Base.pm +# - provides base implementation of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Base; diff --git a/installer/OpenSLX/OSExport/Distro/Debian.pm b/installer/OpenSLX/OSExport/Distro/Debian.pm index d1ae7d88..b764ab4f 100644 --- a/installer/OpenSLX/OSExport/Distro/Debian.pm +++ b/installer/OpenSLX/OSExport/Distro/Debian.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Debian.pm +# - provides Debian-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Debian; diff --git a/installer/OpenSLX/OSExport/Distro/Fedora.pm b/installer/OpenSLX/OSExport/Distro/Fedora.pm index 4e8c0bf0..4c196bd1 100644 --- a/installer/OpenSLX/OSExport/Distro/Fedora.pm +++ b/installer/OpenSLX/OSExport/Distro/Fedora.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Fedora.pm +# - provides Fedora-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Fedora; diff --git a/installer/OpenSLX/OSExport/Distro/Gentoo.pm b/installer/OpenSLX/OSExport/Distro/Gentoo.pm index 1df759dd..79fa2210 100644 --- a/installer/OpenSLX/OSExport/Distro/Gentoo.pm +++ b/installer/OpenSLX/OSExport/Distro/Gentoo.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Gentoo.pm -# - provides Gentoo-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Gentoo; diff --git a/installer/OpenSLX/OSExport/Distro/SUSE.pm b/installer/OpenSLX/OSExport/Distro/Suse.pm index 7f5d5548..c3392f11 100644 --- a/installer/OpenSLX/OSExport/Distro/SUSE.pm +++ b/installer/OpenSLX/OSExport/Distro/Suse.pm @@ -8,10 +8,10 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Suse.pm +# - provides SUSE-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- -package OpenSLX::OSExport::Distro::SUSE; +package OpenSLX::OSExport::Distro::Suse; use strict; use warnings; diff --git a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm index 0f60b63f..c488ffdf 100644 --- a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm +++ b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Ubuntu; diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm index 7aba36da..60777f07 100644 --- a/installer/OpenSLX/OSExport/Engine.pm +++ b/installer/OpenSLX/OSExport/Engine.pm @@ -24,7 +24,7 @@ use Exporter; @EXPORT = qw( %supportedExportFileSystems %supportedExportBlockDevices - @supportedExportTypes %supportedDistros + @supportedExportTypes ); use File::Basename; @@ -34,7 +34,7 @@ use OpenSLX::Utils; our ( %supportedExportFileSystems, %supportedExportBlockDevices, - @supportedExportTypes, %supportedDistros + @supportedExportTypes, ); %supportedExportFileSystems = ( @@ -55,15 +55,6 @@ our ( 'sqfs-nbd', ); -%supportedDistros = ( - '<any>' => {module => 'Any'}, - 'debian' => {module => 'Debian'}, - 'fedora' => {module => 'Fedora'}, - 'gentoo' => {module => 'Gentoo'}, - 'suse' => {module => 'SUSE'}, - 'ubuntu' => {module => 'Ubuntu'}, -); - ################################################################################ ### interface methods ################################################################################ @@ -213,25 +204,21 @@ sub _initialize $self->{'export-name'} = $exportName; $self->{'export-type'} = $exportType; $vendorOSName =~ m[^(.+?\-[^-]+)]; - my $distroName = $1; - $self->{'distro-name'} = $distroName; + $self->{'distro-name'} = lc($1); + my $distroName = ucfirst(lc($1)); # load module for the requested distro: - if (!exists $supportedDistros{lc($distroName)}) { - # try without _x86_64: - $distroName =~ s[_x86_64$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # try basic distro-type (e.g. debian or suse): - $distroName =~ s[-.+$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # fallback to generic implementation: - $distroName = '<any>'; - } - } + my $distro = loadDistroModule({ + distroName => $distroName, + distroScope => 'OpenSLX::OSExport::Distro', + fallbackName => 'Any', + }); + if (!$distro) { + die _tr( + 'unable to load any OSExport::Distro module for vendor-OS %s!', + $vendorOSName + ); } - my $distroModuleName = $supportedDistros{lc($distroName)}->{module}; - my $distro = - instantiateClass("OpenSLX::OSExport::Distro::$distroModuleName"); $distro->initialize($self); $self->{distro} = $distro; diff --git a/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm index 005c0355..43385a29 100644 --- a/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm +++ b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Any_Clone.pm -# - provides generic clone-only overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Any_Clone.pm +# - provides generic clone-only overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Any_Clone; diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm index 573114e8..bcc331bb 100644 --- a/installer/OpenSLX/OSSetup/Distro/Base.pm +++ b/installer/OpenSLX/OSSetup/Distro/Base.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Base.pm -# - provides empty base of the OpenSLX OSSetup API. +# OSSetup/Distro/Base.pm +# - provides base implementation of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Base; diff --git a/installer/OpenSLX/OSSetup/Distro/Debian.pm b/installer/OpenSLX/OSSetup/Distro/Debian.pm index c8c02cdd..85f72d4f 100644 --- a/installer/OpenSLX/OSSetup/Distro/Debian.pm +++ b/installer/OpenSLX/OSSetup/Distro/Debian.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Debian.pm +# - provides Debian-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Debian; diff --git a/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm b/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm index e6ea3722..03c6fdf9 100644 --- a/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm +++ b/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian_3_1.pm -# - provides Debian-3.1-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Debian_3_1.pm +# - provides Debian-3.1-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Debian_3_1; diff --git a/installer/OpenSLX/OSSetup/Distro/Fedora.pm b/installer/OpenSLX/OSSetup/Distro/Fedora.pm index 0bc9ebdc..80480340 100644 --- a/installer/OpenSLX/OSSetup/Distro/Fedora.pm +++ b/installer/OpenSLX/OSSetup/Distro/Fedora.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Fedora.pm +# - provides Fedora-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Fedora; diff --git a/installer/OpenSLX/OSSetup/Distro/Gentoo.pm b/installer/OpenSLX/OSSetup/Distro/Gentoo.pm index c49ba5d6..1f1e0577 100644 --- a/installer/OpenSLX/OSSetup/Distro/Gentoo.pm +++ b/installer/OpenSLX/OSSetup/Distro/Gentoo.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Gentoo; diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE.pm b/installer/OpenSLX/OSSetup/Distro/Suse.pm index 192ea3aa..97da4f70 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE.pm +++ b/installer/OpenSLX/OSSetup/Distro/Suse.pm @@ -8,10 +8,10 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Suse.pm +# - provides SUSE-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::SUSE; +package OpenSLX::OSSetup::Distro::Suse; use strict; use warnings; diff --git a/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm b/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm index c0660818..a2a397ed 100644 --- a/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm +++ b/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Ubuntu; diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 76adeaa6..503b10cb 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -38,84 +38,32 @@ use OpenSLX::Utils; use vars qw(%supportedDistros); %supportedDistros = ( - 'debian-3.1' => { - module => 'Debian_3_1', support => 'clone,install' - }, - 'debian-4.0' => { - module => 'Debian', support => 'clone,install' - }, - 'debian-4.0_amd64' => { - module => 'Debian', support => 'clone,install' - }, - 'fedora-6' => { - module => 'Fedora', support => 'clone,install' - }, - 'fedora-6_x86_64' => { - module => 'Fedora', support => 'clone,install' - }, - 'gentoo-2006.X' => { - module => 'Gentoo', support => 'clone' - }, - 'gentoo-2007.X' => { - module => 'Gentoo', support => 'clone' - }, - 'mandriva-2007.0' => { - module => 'Mandriva_2007_0', support => 'clone' - }, - 'suse-9.3' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.0' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.0_x86_64' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.1' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.1_x86_64' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.2' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.2_x86_64' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.3' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.3_x86_64' => { - module => 'SUSE', support => 'clone' - }, - 'ubuntu-6.06' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-6.10' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-6.10_amd64' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.04' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.04_amd64' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.10' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-7.10_amd64' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-8.04' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-8.04_amd64' => { - module => 'Ubuntu', support => 'clone' - }, + 'debian-3.1' => 'clone,install', + 'debian-4.0' => 'clone,install', + 'debian-4.0_amd64' => 'clone,install', + 'fedora-6' => 'clone,install', + 'fedora-6_x86_64' => 'clone,install', + 'gentoo-2006.X' => 'clone', + 'gentoo-2007.X' => 'clone', + 'mandriva-2007.0' => 'clone', + 'suse-9.3' => 'clone', + 'suse-10.0' => 'clone', + 'suse-10.0_x86_64' => 'clone', + 'suse-10.1' => 'clone,install', + 'suse-10.1_x86_64' => 'clone,install', + 'suse-10.2' => 'clone,install', + 'suse-10.2_x86_64' => 'clone,install', + 'suse-10.3' => 'clone', + 'suse-10.3_x86_64' => 'clone', + 'ubuntu-6.06' => 'clone', + 'ubuntu-6.10' => 'clone,install', + 'ubuntu-6.10_amd64' => 'clone,install', + 'ubuntu-7.04' => 'clone,install', + 'ubuntu-7.04_amd64' => 'clone,install', + 'ubuntu-7.10' => 'clone', + 'ubuntu-7.10_amd64' => 'clone', + 'ubuntu-8.04' => 'clone', + 'ubuntu-8.04_amd64' => 'clone', ); my %localHttpServers; @@ -146,20 +94,20 @@ sub initialize "Given vendor-OS has unknown format, expected '<name>-<release>[-<selection>]'\n" ); } - my $distroName = $1; + my $distroName = lc($1); my $selectionName = $2 || 'default'; $self->{'vendor-os-name'} = $vendorOSName; $self->{'action-type'} = $actionType; - $self->{'distro-name'} = lc($distroName); + $self->{'distro-name'} = $distroName; $self->{'selection-name'} = $selectionName; $self->{'clone-source'} = ''; - if (!exists $supportedDistros{lc($distroName)}) { + if (!exists $supportedDistros{$distroName}) { print _tr("Sorry, distro '%s' is unsupported.\n", $distroName); print _tr("List of supported distros:\n\t"); print join("\n\t", sort keys %supportedDistros) . "\n"; exit 1; } - my $support = $supportedDistros{lc($distroName)}->{support}; + my $support = $supportedDistros{$distroName}; if ($support !~ m[install]i) { if ($actionType eq 'install') { print _tr( @@ -185,22 +133,16 @@ sub initialize } # load module for the requested distro: - my $distro; - my $distroClass = $supportedDistros{lc($distroName)}->{module}; - if ($actionType =~ m{^(install|update|shell)}) { - $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass"); - } - else { - if (!eval { - $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass") - }) { - vlog(2, "could not load distro module '$distroClass' ($@) ..."); - vlog(2, "falling back to module 'Any_Clone'"); - # 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 = loadDistroModule({ + distroName => $distroName, + distroScope => 'OpenSLX::OSSetup::Distro', + fallbackName => 'Any_Clone', + }); + if (!$distro) { + die _tr( + 'unable to load any OSSetup::Distro module for vendor-OS %s!', + $vendorOSName + ); } $distro->initialize($self); @@ -1707,10 +1649,12 @@ sub _clone_fetchSource ) ); print $rsyncFH $excludeIncludeList; - close($rsyncFH) - or croak _tr( + if (!close($rsyncFH)) { + print "rsync-result=", 0+$!, "\n"; + croak _tr( "unable to clone from source '%s', giving up! (%s)\n", $source, $! ); + } return; } diff --git a/installer/slxos-setup b/installer/slxos-setup index 5e9bf650..e5e44d58 100755 --- a/installer/slxos-setup +++ b/installer/slxos-setup @@ -160,7 +160,7 @@ if ($action =~ m[^import]i) { print join('', map { "\t$_" .(' 'x(20-length($_))) - ."\t($supportedDistros{$_}->{support})\n" + ."\t($supportedDistros{$_})\n" } sort keys %supportedDistros); } elsif ($action =~ m[^list-in]i) { |