From 28ff1e4fa1855bbedf5fd9ea9e44eb74ae32ccfc Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 20 Jul 2007 17:08:15 +0000 Subject: * 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 --- installer/OpenSLX/OSSetup/Distro/Base.pm | 25 +++++++++++++++++++++++++ installer/OpenSLX/OSSetup/Engine.pm | 7 +++++++ 2 files changed, 32 insertions(+) (limited to 'installer') diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm index 09323b52..9b59a828 100644 --- a/installer/OpenSLX/OSSetup/Distro/Base.pm +++ b/installer/OpenSLX/OSSetup/Distro/Base.pm @@ -134,6 +134,31 @@ sub finishSession { } +sub pickKernelFile +{ + my $self = shift; + my $kernelPath = shift; + + my $newestKernelFile; + my $newestKernelFileSortKey = ''; + foreach my $kernelFile (glob("$kernelPath/vmlinuz-*")) { + next unless $kernelFile =~ m{ + vmlinuz-(\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) { + $newestKernelFile = $kernelFile; + $newestKernelFileSortKey = $sortKey; + } + } + + if (!defined $newestKernelFile) { + die _tr("unable to pick a kernel-file from path '%s'!", $kernelPath); + } + return $newestKernelFile; +} + 1; ################################################################################ diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 5737814b..233ba33c 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -596,6 +596,13 @@ sub removeVendorOSFromConfigDB return; } +sub pickKernelFile +{ + my $self = shift; + + return $self->{distro}->pickKernelFile(@_); +} + ################################################################################ ### implementation methods ################################################################################ -- cgit v1.2.3-55-g7522