summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBastian Wissler2009-06-05 20:17:40 +0200
committerBastian Wissler2009-06-05 20:17:40 +0200
commit6fb82427d4e3cb76e20700d8e0cfb609056ec2b9 (patch)
treec5bd7c32cd586e4ff482c27478d91d3906ea6c3f /lib
parentFixing #450: (diff)
downloadcore-6fb82427d4e3cb76e20700d8e0cfb609056ec2b9.tar.gz
core-6fb82427d4e3cb76e20700d8e0cfb609056ec2b9.tar.xz
core-6fb82427d4e3cb76e20700d8e0cfb609056ec2b9.zip
Various changes to xserver plugin:
* added support for kernel version detection - yet from local function * now falls back to ati package installation, if download fails ATTENTION: If you have a recent Kernel Version in Suse-11.1, consider downgrading your Kernel to support fglrx-drivers from their RPM repository. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2937 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib')
-rw-r--r--lib/OpenSLX/DistroUtils.pm22
-rw-r--r--lib/OpenSLX/DistroUtils/Base.pm35
-rw-r--r--lib/OpenSLX/DistroUtils/Engine.pm8
3 files changed, 62 insertions, 3 deletions
diff --git a/lib/OpenSLX/DistroUtils.pm b/lib/OpenSLX/DistroUtils.pm
index dd29a46a..1bda311f 100644
--- a/lib/OpenSLX/DistroUtils.pm
+++ b/lib/OpenSLX/DistroUtils.pm
@@ -19,6 +19,8 @@ use warnings;
use OpenSLX::Utils;
use OpenSLX::Basics;
+use Data::Dumper;
+
use OpenSLX::DistroUtils::Engine;
use OpenSLX::DistroUtils::InitFile;
@@ -34,6 +36,7 @@ $VERSION = 1.01;
newInitFile
getInitFileForDistro
simpleInitFile
+ getKernelVersionForDistro
);
@@ -68,6 +71,25 @@ sub getInitFileForDistro {
return $distro->generateInitFile($initFile);
}
+sub getKernelVersionForDistro {
+ my $kernelPath = shift;
+ my $distroName = shift;
+
+
+ print Dumper(@INC);
+
+ my $engine = OpenSLX::DistroUtils::Engine->new();
+ my $distro;
+
+ if ($distroName) {
+ $distro = $engine->loadDistro($distroName);
+ } else {
+ $distro = $engine->loadDistro('Base');
+ }
+
+ return $distro->getKernelVersion($kernelPath);
+
+}
diff --git a/lib/OpenSLX/DistroUtils/Base.pm b/lib/OpenSLX/DistroUtils/Base.pm
index 90cad7a0..f4eb45c8 100644
--- a/lib/OpenSLX/DistroUtils/Base.pm
+++ b/lib/OpenSLX/DistroUtils/Base.pm
@@ -356,5 +356,38 @@ sub generateInitFile
}
+sub getKernelVersion
+{
+ my $self = shift;
+ my $kernelPath = shift;
+
+
+ my $newestKernelFile;
+ my $newestKernelFileSortKey = '';
+ my $kernelPattern = '{vmlinuz,kernel-genkernel-x86}-*';
+ foreach my $kernelFile (glob("$kernelPath/$kernelPattern")) {
+ next unless $kernelFile =~ 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) {
+ $newestKernelFile = $kernelFile;
+ $newestKernelFileSortKey = $sortKey;
+ }
+ }
+
+ if (!defined $newestKernelFile) {
+ die _tr("unable to pick a kernel-file from path '%s'!", $kernelPath);
+ }
+
+ $newestKernelFile =~ /.*?-([.\-0-9]*)-([a-zA-Z]*?)$/;
+ my $kernel = {};
+ $kernel->{'version'} = $1;
+ $kernel->{'suffix'} = $2;
+ return $kernel;
+
+}
+
-1; \ No newline at end of file
+1;
diff --git a/lib/OpenSLX/DistroUtils/Engine.pm b/lib/OpenSLX/DistroUtils/Engine.pm
index 88a1f166..839e6564 100644
--- a/lib/OpenSLX/DistroUtils/Engine.pm
+++ b/lib/OpenSLX/DistroUtils/Engine.pm
@@ -14,6 +14,7 @@
package OpenSLX::DistroUtils::Engine;
use OpenSLX::Basics;
+use Data::Dumper;
use strict;
use warnings;
@@ -35,11 +36,13 @@ sub loadDistro {
my $pathToClass = "$openslxConfig{'base-path'}/lib";
my $flags = {};
- $flags->{incPaths} = [ $pathToClass, "/mnt/$pathToClass" ];
+ #$flags->{incPaths} = [ $pathToClass, "/mnt/$pathToClass" ];
# for the case we call this function inside the chrooted environment of a plugin's
# install method we add the corrected searchpath to INC
# TODO: fix this problem via plugin engine
+ print 'DUMP INC 2';
+ print Dumper(@INC);
my $loaded = eval {
$distro = instantiateClass("OpenSLX::DistroUtils::${distroName}", $flags);
return 0 if !$distro; # module does not exist, try next
@@ -57,9 +60,10 @@ sub loadDistro {
if (!$loaded) {
vlog(1, "failed to load DistroUtils!");
+ vlog(1, $distroName);
}
return $distro;
}
-1; \ No newline at end of file
+1;