diff options
author | Oliver Tappe | 2007-07-20 19:08:15 +0200 |
---|---|---|
committer | Oliver Tappe | 2007-07-20 19:08:15 +0200 |
commit | 28ff1e4fa1855bbedf5fd9ea9e44eb74ae32ccfc (patch) | |
tree | f6fc3c3881ef5da44dfaa246067e418a124df363 /config-db | |
parent | git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1264 95ad53e4-c205-0410-... (diff) | |
download | core-28ff1e4fa1855bbedf5fd9ea9e44eb74ae32ccfc.tar.gz core-28ff1e4fa1855bbedf5fd9ea9e44eb74ae32ccfc.tar.xz core-28ff1e4fa1855bbedf5fd9ea9e44eb74ae32ccfc.zip |
* added support for automatic selection of most appropriate (newest) kernel
if the kernel file specified by DB (in most cases: vmlinuz) does not exist.
A warning will be printed by slxconfig-demuxer if the kernel had to be
picked this way.
This should allow slxconfig-demuxer to work for ubuntu & debian, as those
do not always provide a vmlinuz-link (and in general this change makes
the system more robust).
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1265 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rw-r--r-- | config-db/OpenSLX/ConfigDB.pm | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm index 1298b2d8..94ad9faf 100644 --- a/config-db/OpenSLX/ConfigDB.pm +++ b/config-db/OpenSLX/ConfigDB.pm @@ -47,6 +47,7 @@ my @supportExports = qw( ################################################################################ use OpenSLX::Basics; use OpenSLX::DBSchema; +use OpenSLX::Utils; sub _checkAndUpgradeDBSchemaIfNecessary { @@ -501,10 +502,16 @@ sub addSystem my $valRows = _aref(shift); foreach my $valRow (@$valRows) { - if (!defined $valRow->{kernel} || !length($valRow->{kernel})) { + if (!$valRow->{kernel}) { $valRow->{kernel} = 'vmlinuz'; + warn( + _tr( + "setting kernel of system '%s' to 'vmlinuz'!", + $valRow->{name} + ) + ); } - if (!defined $valRow->{label} || !length($valRow->{label})) { + if (!$valRow->{label}) { $valRow->{label} = $valRow->{name}; } } @@ -959,14 +966,32 @@ sub aggregatedSystemFileInfoFor } $info->{'vendor-os'} = $vendorOS; + # check if the specified kernel file really exists (follow links while + # checking) and if not, find the newest kernel file that is available. my $kernelPath = "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}/boot"; - $info->{'kernel-file'} = "$kernelPath/$system->{kernel}"; + my $kernelFile = "$kernelPath/$system->{kernel}"; + while (-l $kernelFile) { + $kernelFile = followLink($kernelFile); + } + if (!-e $kernelFile) { + # pick best kernel file available + my $osSetupEngine = instantiateClass("OpenSLX::OSSetup::Engine"); + $osSetupEngine->initialize($vendorOS->{name}, 'none'); + $kernelFile = $osSetupEngine->pickKernelFile($kernelPath); + warn( + _tr( + "setting kernel of system '%s' to '%s'!", + $info->{name}, $kernelFile + ) + ); + } + $info->{'kernel-file'} = $kernelFile; + # auto-generate export_uri if none has been given my $exportURI = $export->{'uri'} || ''; if ($exportURI !~ m[\w]) { - # auto-generate export_uri if none has been given: - my $type = $export->{'type'}; + # instantiate OSExport engine and ask it for exportURI my $osExportEngine = instantiateClass("OpenSLX::OSExport::Engine"); $osExportEngine->initializeFromExisting($export->{name}); $exportURI = $osExportEngine->generateExportURI($export, $vendorOS); |