diff options
author | Oliver Tappe | 2008-09-03 18:43:21 +0200 |
---|---|---|
committer | Oliver Tappe | 2008-09-03 18:43:21 +0200 |
commit | 9b2866ba9bb1f43d615e884a71196f30048e6884 (patch) | |
tree | ad01c77ac72217c305afe822bcb1632d0f2c6974 /boot-env | |
parent | bugfix, check if file exists first. (diff) | |
download | core-9b2866ba9bb1f43d615e884a71196f30048e6884.tar.gz core-9b2866ba9bb1f43d615e884a71196f30048e6884.tar.xz core-9b2866ba9bb1f43d615e884a71196f30048e6884.zip |
* instead of picking the first system encountered, the preboot cd is now
based on the system with the newest kernel - this should minimize any
compatibility problems
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2199 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env')
-rw-r--r-- | boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm index 994e6dd0..50bf5ca5 100644 --- a/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm +++ b/boot-env/OpenSLX/BootEnvironment/PREBOOT_CD.pm @@ -62,7 +62,8 @@ sub writeBootloaderMenuFor my $externalClientID = shift; my $systemInfos = shift || []; - my $prebootSystemInfo = clone($systemInfos->[0]); + my $prebootSystemInfo + = clone($self->_pickSystemWithNewestKernel($systemInfos)); $self->_createImage($client, $prebootSystemInfo); # $self->_prepareBootloaderConfigFolder() @@ -123,6 +124,31 @@ sub writeBootloaderMenuFor return 1; } +sub _pickSystemWithNewestKernel +{ + my $self = shift; + my $systemInfos = shift; + + my $systemWithNewestKernel; + my $newestKernelFileSortKey = ''; + foreach my $system (@$systemInfos) { + next unless $system->{'kernel-file'} =~ m{ + (?:vmlinuz|x86)-(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?-(\d+(?:\.\d+)?) + }x; + my $sortKey + = sprintf("%02d.%02d.%02d.%02d-%2.1f", $1, $2, $3, $4||0, $5); + if ($newestKernelFileSortKey lt $sortKey) { + $systemWithNewestKernel = $system; + $newestKernelFileSortKey = $sortKey; + } + } + + if (!defined $systemWithNewestKernel) { + die _tr("unable to pick a system to be used for preboot!"); + } + return $systemWithNewestKernel; +} + sub _createImage { my $self = shift; |