summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/OpenSLX/DistroUtils.pm22
-rw-r--r--lib/OpenSLX/DistroUtils/Base.pm35
-rw-r--r--lib/OpenSLX/DistroUtils/Engine.pm8
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm4
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm39
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm106
6 files changed, 200 insertions, 14 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;
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index eb402578..d1eb961d 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -669,9 +669,13 @@ sub _callChrootedFunctionForPlugin
$hostPerlCorePath, $hostPerlCorePathInChroot, $!
);
unshift @INC, '/mnt/host-perl';
+ unshift @INC, "/mnt$openslxConfig{'base-path'}/lib";
1
},
release => sub {
+ if ($INC[0] eq "/mnt$openslxConfig{'base-path'}/lib") {
+ shift @INC;
+ }
if ($INC[0] eq '/mnt/host-perl') {
shift @INC;
}
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
index 04f85ed9..70a08859 100644
--- a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
@@ -173,11 +173,11 @@ sub getdkms
{
if( !-f "/sbin/dkms") {
if(!-f "dkms-2.0.21.1.tar.gz" ) {
- system("wget http://linux.dell.com/dkms/permalink/dkms-2.0.21.1.tar.gz");
+ system("wget http://linux.dell.com/dkms/permalink/dkms-2.0.21.1.tar.gz >/dev/null 2>&1");
die("Could not download dkms tarball! Exiting!") if($? > 0 );
}
if(!-f "dkms-2.0.21.1/dkms" ) {
- system("tar -zxvf dkms-2.0.21.1.tar.gz dkms-2.0.21.1/dkms");
+ system("tar -zxvf dkms-2.0.21.1.tar.gz dkms-2.0.21.1/dkms >/dev/null 2>&1");
die("Could not extract dkms script from tarball! Exiting!") if($? > 0 );
}
copyFile("dkms-2.0.21.1/dkms","/sbin");
@@ -185,4 +185,39 @@ sub getdkms
}
}
+
+sub getKernelVersion
+{
+ my $self = shift;
+ my $kernelPath = shift;
+
+ my $newestKernelFile;
+ my $newestKernelFileSortKey = '';
+ my $sortKey;
+ 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;
+ $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;
+# return $newestKernelFile;
+
+}
+
1;
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
index b96f6ffb..e9505b4e 100644
--- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
@@ -23,7 +23,9 @@ use File::Path;
use OpenSLX::Basics;
use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+use Data::Dumper;
################################################################################
### interface methods
@@ -63,9 +65,9 @@ sub installNvidia
system("rm -rf $tmpdir/*");
}
- # TODO: Sort out kernel version programmatically
- my $kver = "2.6.25.20-0.1";
- my $ksuffix = "pae";
+ my $mykernel = $self->SUPER::getKernelVersion("/boot");
+ my $kver = $mykernel->{'version'};
+ my $ksuffix = $mykernel->{'suffix'};
my $srinfo = `head -n1 /etc/SuSE-release`;
my @data = split (/ /, $srinfo);
@@ -88,7 +90,7 @@ sub installNvidia
my $rpm = @rpm;
if($rpm == 0) {
- print "Could not find nvidia kernel module rpm on filesystem!";
+ print "Could not download nvidia kernel module rpm!";
return;
}
@@ -143,11 +145,12 @@ sub installAti
system("rm -rf $tmpdir/*");
}
- # TODO: Sort out kernel version programmatically
- my $kver = "2.6.25.20-0.1";
+ my $mykernel = $self->SUPER::getKernelVersion("/boot");
+ my $kver = $mykernel->{'version'};
my $kver_ati = $kver;
$kver_ati =~ s/-/_/;
- my $ksuffix = "pae";
+
+ my $ksuffix = $mykernel->{'suffix'};
my $srinfo = `head -n1 /etc/SuSE-release`;
my @data = split (/ /, $srinfo);
@@ -170,8 +173,9 @@ sub installAti
my $rpm = @rpm;
if($rpm == 0) {
- print "Could not find ATI kernel module rpm on filesystem!\n";
- print "Exiting!";
+ print "Could not download ATI kernel module rpm (for kernel $kver)!\n";
+ print "Consider downgrading your Kernel! \nTrying package-install!\n";
+ $self->installAtiOldStyle(@_);
return;
}
@@ -215,4 +219,88 @@ sub installAti
rmtree($tmpdir);
}
+
+
+sub installAtiOldStyle
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+
+ my $ret = $self->SUPER::installAti(@_);
+
+ if($ret =~ /^error$/) {
+ print "Something went wrong installing ATI files!\n";
+ return;
+ }
+
+ $self->SUPER::getdkms();
+ my $mykernel = $self->SUPER::getKernelVersion("/boot");
+ my $kver = $mykernel->{'version'};
+ my $kver_ati = $kver;
+ $kver_ati =~ s/-/_/;
+
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ # here we have to compile the kernel modules for all kernels
+ #
+ my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-*.run | grep -P -o '[0-9]+\.[0-9]{3}' | tail -n1`;
+ chomp($ati_version);
+
+ system("mv $ret /usr/src/fglrx-$ati_version >/dev/null 2>&1");
+
+ open FH,">/usr/src/fglrx-$ati_version/dkms.conf";
+ print FH "DEST_MODULE_LOCATION=/updates\n";
+ print FH "PACKAGE_NAME=fglrx\n";
+ print FH "PACKAGE_VERSION=$ati_version\n";
+ close FH;
+
+ my $cmd = "#============= Executing following command =============\n".
+ "/sbin/dkms ".
+ " -m fglrx -v $ati_version ".
+ " -k $kver-$ksuffix ".
+ " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ".
+ " --no-prepare-kernel ".
+ " --no-clean-kernel ".
+ " build >/dev/null 2>&1 \n".
+ "#==========================================================";
+
+#print $cmd;
+ if(!-f "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ system("/sbin/dkms add -m fglrx -v $ati_version >/dev/null 2>&1");
+ system($cmd);
+ #if ($? > 0) {
+ # print "\n\nCould not compile module! Exit with Ctrl-D\n";
+ # system("/bin/bash");
+ #}
+ }
+
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir( "$repopath/ati/modules/" );
+ }
+
+ if( -e "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko",
+ "$repopath/ati/modules");
+ }
+ else {
+ print "Could not install ati driver via pkg-installer!\n";
+ rmtree($repopath."/ati");
+ return;
+ }
+ rmtree("$repopath/ati/temp");
+
+
+}
+
1;