diff options
author | Bastian Wissler | 2009-05-14 19:27:12 +0200 |
---|---|---|
committer | Bastian Wissler | 2009-05-14 19:27:12 +0200 |
commit | 641917d1f5eae763fbb6cffe4b583c2dd06d7d5e (patch) | |
tree | 68cbdf42e9f3814f95635e51b0c44ed5737f34b8 /os-plugins/plugins | |
parent | status in wlanboot plugin and typo in suse-11.1 installation (diff) | |
download | core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.tar.gz core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.tar.xz core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.zip |
xserver plugin (some severe changes):
* Suse-11.x driver installation supported by perl module in Distro
* Ubuntu-9.04 tested with recent scripts (ubuntu-8.10-gfx-install.sh)
* this version does NOT (yet) support < suse-11.0, < ubuntu-8.04
-> below suse-11.0 is only not tested
* we use driver packages just for ati drivers on SuSE-11.0 and greater
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2856 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins')
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm | 112 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm | 180 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm | 25 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm | 103 | ||||
-rwxr-xr-x | os-plugins/plugins/xserver/files/ubuntu-8.10-gfx-install.sh | 32 |
5 files changed, 387 insertions, 65 deletions
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm index 65ccb879..9672de87 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm @@ -19,6 +19,7 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version use File::Basename; +use File::Path; use OpenSLX::Basics; use OpenSLX::Utils; @@ -73,4 +74,115 @@ sub XserverPathInfo return $pathInfo; } + +# looks for the NVIDIA-installer and extracts it +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my @paths = glob $repopath.$pkgpath."/NVIDIA-Linux-x86*\n"; + my $paths = @paths; + + if ($paths > 1) + { + print "Found more than one NVIDIA-Linux-x86 installer. Taking first one.\n"; + } + if ($paths == 0) + { + print "Found no NVIDIA-Linux-x86 installer. Quitting NVIDIA installation!\n"; + return "error"; + } + + if ( ! -X $paths[0] ) + { + system("chmod +x ".$paths[0]); + } + system($paths[0]." -x --target $repopath/nvidia/temp >/dev/null 2>&1"); + + if($? == -1 ) + { + print "Failed to execute ".$paths[0]."\n"; + return "error"; + } + + system("mv $repopath/nvidia/temp/usr/src $repopath/nvidia/temp/"); + system("mv $repopath/nvidia/temp/usr/ $repopath/nvidia/"); + rmtree("$repopath/nvidia/usr/share/"); + + return "$repopath/nvidia/temp/src/nv"; +} + + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my @paths = glob $repopath."/".$pkgpath."/ati-driver-installer*"; + my $paths = @paths; + + if ($paths > 1) + { + print "Found more than one ati-driver-installer. Taking first one.\n"; + } + if ($paths == 0) + { + print "Found no ati-driver-installer. Quitting ATI installation!\n"; + return "error"; + } + + if ( ! -X $paths[0] ) + { + system("chmod +x ".$paths[0]); + } + system($paths[0]." --extract $repopath/ati/temp >/dev/null 2>&1"); + + if($? == -1 ) + { + print "Failed to execute ".$paths[0]."\n"; + return "error"; + } + + # TODO: allow x86_64 driver installation (libs) + my $arch = "x86"; + + rmtree("$repopath/ati/usr"); + system("mv $repopath/ati/temp/common/usr $repopath/ati/"); + if (!-d "$repopath/ati/usr/lib" ) { + mkdir "$repopath/ati/usr/lib"; + } + system("mv $repopath/ati/temp/arch/$arch/usr/X11R6/lib/* $repopath/ati/usr/lib/"); + system("mv $repopath/ati/temp/arch/$arch/usr/lib/* $repopath/ati/usr/lib/"); + rmtree("$repopath/ati/usr/share/"); + + my $cmd='gcc --version | head -n 1 | sed -e "s/[^0-9. ]//g;s/^ *//;s/^\(.\)\..*$/\1/"'; + my $gcc_ver_maj =`$cmd`; + chomp($gcc_ver_maj); + + system("mv $repopath/ati/temp/arch/$arch/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC$gcc_ver_maj $repopath/ati/temp/common/lib/modules/fglrx/build_mod/"); + + + return "$repopath/ati/temp/common/lib/modules/fglrx/build_mod"; +} + +# get dkms with wget/tar and put it into /sbin +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"); + 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"); + die("Could not extract dkms script from tarball! Exiting!") if($? > 0 ); + } + copy("dkms-2.0.21.1/dkms","/sbin/dkms"); + chmod 0755, "/sbin/dkms"; + } +} + 1; diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm index 7ceb704e..6419bc44 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm @@ -24,6 +24,7 @@ use File::Path; use OpenSLX::Basics; use OpenSLX::Utils; + ################################################################################ ### interface methods ################################################################################ @@ -47,4 +48,183 @@ sub setupXserverScript return $script; } + +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $tmpdir = "$repopath/nvidia/temp"; + if( !-d $tmpdir ) { + mkdir( $tmpdir ); + } +# +# my $ret = $self->SUPER::installNvidia(@_); +# +# if($ret =~ /^error$/) { +# print "Something went wrong installing NVIDIA files!\n"; +# return; +# } +# +# $self->SUPER::getdkms(); +# + my $kver = "2.6.25.20-0.1"; + my $ksuffix = "pae"; +# +# # here we have to compile the kernel modules for all kernels +# my $grep = "grep -io DNV_VERSION_STRING=.* $ret/Makefile.nvidia |". +# "cut -d'\\' -f2 | cut -d'\"' -f2"; +# my $nv_version = `$grep`; +# chomp($nv_version); +# +# system("mv $ret /usr/src/nvidia-$nv_version >/dev/null 2>&1"); +# +# open FH,">/usr/src/nvidia-$nv_version/dkms.conf"; +# print FH "DEST_MODULE_LOCATION=/updates\n"; +# print FH "PACKAGE_NAME=nvidia\n"; +# print FH "PACKAGE_VERSION=$nv_version\n"; +# close FH; +# +# system("/sbin/dkms add -m nvidia -v $nv_version"); +# my $cmd = "#============= Executing following command =============\n". +# "/sbin/dkms ". +# " -m nvidia -v $nv_version ". +# " -k $kver-$ksuffix ". +# " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ". +# " --no-prepare-kernel ". +# " --no-clean-kernel ". +# " build \n". +# "#=========================================================="; +# +# print $cmd; +# system($cmd); + + + my $srinfo = `head -n1 /etc/SuSE-release`; + my @data = split (/ /, $srinfo); + chomp(@data); + + my $version = $data[1]; + my $chost = substr($data[2],1,-1); + + my $url = "ftp://download.nvidia.com/opensuse/$version/$chost"; + system("wget -P $tmpdir $url/nvidia-gfxG01-kmp-$ksuffix* >/dev/null 2>&1"); + + if($? > 0) { + print "Could not download nvidia kernel module rpm!\n"; + } + + my @rpm = glob "$tmpdir/nvidia-gfxG01*.rpm"; + my $rpm = @rpm; + + if($rpm == 0) { + print "Could not find nvidia kernel module rpm on filesystem!"; + return; + } + + system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1"); + + if(!-d "$repopath/nvidia/modules/") + { + mkdir("$repopath/nvidia/modules/"); + } + copyFile("$tmpdir/lib/modules/$kver-$ksuffix/updates/nvidia.ko", + "$repopath/nvidia/modules"); + + + my @versions = split(/-/, $rpm[0]); + my @nv_versions = split('_',$versions[5]); + my $nv_version = $nv_versions[0]; + + system("wget -P $tmpdir $url/x11-video-nvidiaG01-$nv_version* >/dev/null 2>&1"); + + @rpm = glob "$tmpdir/x11-video-nvidiaG01-$nv_version*"; + $rpm = @rpm; + + if($rpm == 0) + { + print "Could not download x11-video-nvidia-$nv_version*.rpm!\n"; + print "Exiting nvidia driver installation!\n"; + return; + } + + system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1"); + + rmtree("$tmpdir/usr/share"); + system("mv $tmpdir/usr $repopath/nvidia/"); + + rmtree($tmpdir); + +} + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $srinfo = `head -n1 /etc/SuSE-release`; + my @data = split (/ /, $srinfo); + chomp(@data); + + my $version = $data[1]; + my $chost = substr($data[2],1,-1); + + my $ret = $self->SUPER::installAti(@_); + + if($ret =~ /^error$/) { + print "Something went wrong intalling ATI files!\n"; + return; + } + + $self->SUPER::getdkms(); + + my $kver = "2.6.25.20-0.1"; + my $ksuffix = "pae"; + + # here we have to compile the kernel modules for all kernels + # + my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-9-1-x86.x86_64.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 \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"); + system($cmd." >/dev/null 2>&1"); + } + + if(!-d "$repopath/ati/modules/") + { + mkdir( "$repopath/ati/modules/" ); + } + copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko", + "$repopath/ati/modules"); + #if ($? > 0) { + # print "\n\nCould not copy! Exit with Ctrl-D\n"; + # system("/bin/bash"); + #} + rmtree("$repopath/ati/temp"); + + +} + 1; diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm index d422c589..537ef54c 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm @@ -42,4 +42,29 @@ sub setupXserverScript return $script; } + +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $distroName = $self->{engine}->distroName(); + + system($repopath."/ubuntu-gfx-install.sh nvidia $distroName"); + +} + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $distroName = $self->{engine}->distroName(); + + system($repopath."/ubuntu-gfx-install.sh ati $distroName"); + +} + 1; diff --git a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm index b21d579a..0191852a 100644 --- a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm +++ b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm @@ -243,45 +243,34 @@ sub installationPhase $self->removeLinks(); if ($attrs->{'xserver::nvidia'} == 1 || $attrs->{'xserver::ati'} == 1 ) { - copyFile("$pluginFilesPath/ubuntu-gfx-install.sh", "$installationPath"); - copyFile("$pluginFilesPath/suse-gfx-install.sh", "$installationPath"); - copyFile("$pluginFilesPath/ubuntu-8.10-gfx-install.sh", "$installationPath"); - + if($vendorOSName =~ /.*?ubuntu.*?/i) + { + if($vendorOSName =~ /.*?8.10|9.04|9.10.*?/i) + { + copyFile("$pluginFilesPath/ubuntu-8.10-gfx-install.sh", + "$installationPath"); + rename("$installationPath/ubuntu-8.10-gfx-install.sh", + "$installationPath/ubuntu-gfx-install.sh"); + } + else + { + copyFile("$pluginFilesPath/ubuntu-gfx-install.sh", "$installationPath"); + } + } $binDrivers = 1; } - if ($attrs->{'xserver::ati'} == 1) { - copyFile("$pluginFilesPath/ati-install.sh", "$installationPath"); - system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/ati-install.sh $vendorOSName"); + if ($attrs->{'xserver::ati'} == 1 ) { + $self->{distro}->installAti($pluginRepoPath,"packages"); } - if ($attrs->{'xserver::nvidia'} == 1) { - copyFile("$pluginFilesPath/nvidia-install.sh", "$installationPath"); - system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/nvidia-install.sh $vendorOSName"); + if ($attrs->{'xserver::nvidia'} == 1 ) { + $self->{distro}->installNvidia($pluginRepoPath,"packages"); } - - if ($binDrivers == 1) { $self->ldconf($info); - `chmod -R 755 $installationPath` + system("chmod -R 755 $installationPath"); } - # Some plugins have to copy files from their plugin folder into the - # vendor-OS. Here's an example for how to do that: - # - # # get our own name: - # my $pluginName = $self->{'name'}; - # - # # get our own base path: - # my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName"; - # - # # copy all needed files now: - # foreach my $file ( qw( file1, file2 ) ) { - # copyFile("$pluginBasePath/$file", "$pluginRepoPath/"); - # } - - # name of current os - # my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'} - return; } @@ -321,32 +310,37 @@ sub ldconf my $ldincl = $info->{'plugin-repo-path'}.'/'; my $ldpl = "/etc/ld.conf.preload"; my $ldconf = "/etc/ld.so.conf"; + my $ldcache = ""; - ## WRITE ld.so.conf for different GL-implementations ## - - open(IN,'>'.$ldincl.'nvidia/ld.so.conf'); - print IN $ldincl."nvidia/usr/lib\n".$ldincl.'nvidia/usr/X11R6/lib'; - close(IN); - open(IN,'>'.$ldincl.'ati/ld.so.conf'); - print IN $ldincl."ati/usr/lib\n".$ldincl.'ati/usr/X11R6/lib'; - close(IN); - - + if( -d $ldincl.'nvidia/') { - ## CREATE TWO DIFFERENT 'ld.so.cache's ## - - my $ldcache = $ldincl.'/nvidia/ld.so.cache'; - system('sed -e "1s,^,include '.$ldincl.'nvidia/ld.so.conf\n,g" -i '.$ldconf); - #print "Calling ldconfig to create $ldcache ... Please Wait\n"; - system('ldconfig -C '.$ldcache); - system('sed -e "1d" -i '.$ldconf); + ## WRITE ld.so.conf ## + + open(IN,'>'.$ldincl.'nvidia/ld.so.conf'); + print IN $ldincl."nvidia/usr/lib\n".$ldincl.'nvidia/usr/X11R6/lib'; + close(IN); + + ## CREATE DIFFERENT 'ld.so.cache' ## + + $ldcache = $ldincl.'/nvidia/ld.so.cache'; + system('sed -e "1s,^,include '.$ldincl.'nvidia/ld.so.conf\n,g" -i '.$ldconf); + #print "Calling ldconfig to create $ldcache ... Please Wait\n"; + system('ldconfig -C '.$ldcache); + system('sed -e "1d" -i '.$ldconf); + } - $ldcache = $ldincl.'/ati/ld.so.cache'; - system('sed -e "1s,^,include '.$ldincl.'ati/ld.so.conf\n,g" -i '.$ldconf); - #print "Calling ldconfig to create $ldcache ... Please Wait\n"; - system('ldconfig -C '.$ldcache); - system('sed -e "1d" -i '.$ldconf); + if( -d $ldincl.'ati/') { + open(IN,'>'.$ldincl.'ati/ld.so.conf'); + print IN $ldincl."ati/usr/lib\n".$ldincl.'ati/usr/X11R6/lib'; + close(IN); + + $ldcache = $ldincl.'/ati/ld.so.cache'; + system('sed -e "1s,^,include '.$ldincl.'ati/ld.so.conf\n,g" -i '.$ldconf); + #print "Calling ldconfig to create $ldcache ... Please Wait\n"; + system('ldconfig -C '.$ldcache); + system('sed -e "1d" -i '.$ldconf); + } } @@ -354,7 +348,10 @@ sub ldconf # removes linked libraries from /usr/lib/ sub removeLinks { - my $instFolders = "/usr/lib /usr/X11R6/lib"; + my $instFolders = "/usr/lib"; + if(-d "/usr/X11R6/lib") { + $instFolders .= "/usr/X11R6/lib"; + } my $divertFolder = "/var/X11R6/lib"; my $pluginFolder = "/opt/openslx/plugin-repo/xserver"; diff --git a/os-plugins/plugins/xserver/files/ubuntu-8.10-gfx-install.sh b/os-plugins/plugins/xserver/files/ubuntu-8.10-gfx-install.sh index 409b2160..f834bbac 100755 --- a/os-plugins/plugins/xserver/files/ubuntu-8.10-gfx-install.sh +++ b/os-plugins/plugins/xserver/files/ubuntu-8.10-gfx-install.sh @@ -95,12 +95,16 @@ case ${TARGET} in if [ $? -eq 0 ]; then echo "ok" else - echo "fail" - echo "------ dkms.log -----" - cat /tmp/dkms.log - echo "---------------------" - rm /tmp/dkms.log - exit 1 + if $(cat /tmp/dkms.log | grep -q "has already"); then + echo -n "--- fglrx module already built ---" + else + echo "fail" + echo "------ dkms.log -----" + cat /tmp/dkms.log + echo "---------------------" + rm /tmp/dkms.log + exit 1 + fi fi FGLRX_MODULE_PATH=$(find ${FGLRX_DKMS_DIR}/${KVER}/ -name fglrx.ko \ @@ -191,12 +195,16 @@ case ${TARGET} in if [ $? -eq 0 ]; then echo "ok" else - echo "fail" - echo "------ dkms.log -----" - cat /tmp/dkms.log - echo "---------------------" - rm /tmp/dkms.log - exit 1 + if $(cat /tmp/dkms.log | grep -q "has already"); then + echo -n "--- nvidia module already built ---" + else + echo "fail" + echo "------ dkms.log -----" + cat /tmp/dkms.log + echo "---------------------" + rm /tmp/dkms.log + exit 1 + fi fi NVIDIA_MODULE_PATH=$(find ${NVIDIA_DKMS_DIR}/${KVER}/ -name \ |