summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/xserver
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins/xserver')
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm212
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm50
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm89
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm63
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm360
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm361
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm53
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm96
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm73
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm30
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm396
-rw-r--r--src/os-plugins/plugins/xserver/XX_xserver.sh351
-rw-r--r--src/os-plugins/plugins/xserver/files/README77
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ati-install.sh24
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/nvidia-install.sh138
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/suse-gfx-install.sh330
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh124
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh236
-rw-r--r--src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh53
19 files changed, 3116 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..51c1c60b
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
@@ -0,0 +1,212 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the xserver plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $pathInfo = $self->XserverPathInfo();
+ my $configFile = $pathInfo->{config};
+
+ my $script = unshiftHereDoc(<<' End-of-Here');
+ # xserver.sh (base part)
+ # written by OpenSLX-plugin 'xserver' (via xserver/Distro/Base.pm module)
+
+ # generating the base configuration file (might be split into several
+ # files for newer Xorg servers)
+ echo -e "# ${xfc#/mnt*}\n# autogenerated X hardware configuration by \
+ the xserver plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN \
+ INSTEAD" >${xfc}
+ # using variables defined in XX_xserver.sh
+ echo -e "${x_modpath}\n${x_srvflags}\n${x_modules}" >>${xfc}
+ echo -e "${x_keyboard}\n${x_mouse}\n${x_videocard}" >>${xfc}
+ echo -e "${x_monitor}\n${x_screen}\n${x_srvlayout}\n${x_dri}" >>${xfc}
+ # if no module was detected, stick to vesa module
+ if [ -n "$xmodule" ] ; then
+ sed "s/vesa/$xmodule/;s/\"us\"/\"${XKEYBOARD}\"/" -i ${xfc}
+ else
+ sed "s/\"us\"/\"${XKEYBOARD}\"/" -i ${xfc}
+ fi
+ if [ -n "${BUSID}" ]; then
+ sed -e "s,^#.*BusID .*, BusID \"${BUSID}\",g" -i ${xfc}
+ fi
+ # end of base xorg.conf generation
+
+ End-of-Here
+
+ return $script;
+}
+
+# not used yet, kept as example
+sub XserverPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/X11/xorg.conf',
+ paths => [
+ '/usr/bin',
+ ],
+ };
+
+ 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 >/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 >/dev/null 2>&1");
+ die("Could not extract dkms script from tarball! Exiting!") if($? > 0 );
+ }
+ copyFile("dkms-2.0.21.1/dkms","/sbin");
+ chmod 0755, "/sbin/dkms";
+ }
+}
+
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..29156e60
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,50 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # Debian specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb
+ End-of-Here
+
+ return $script;
+}
+
+# stage3 script might need to add special path /var/X11R6/bin to the PATH variable
+# # fixme!! add path directly to /etc/profile!?
+# #[ "x$addpath" != "x" ] && \
+# # echo -e "# added path component by $0: $date\n\
+# #PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/profile
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..7a706019
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,89 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ # add stuff to the script generated via Base.pm
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/etc/X11/xorg.conf.d
+ # Add InputClass to proper setup the keyboard and other input
+ echo 'Section "InputClass"
+ Identifier "evdev pointer catchall"
+ MatchIsPointer "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev keyboard catchall"
+ MatchIsKeyboard "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev touchpad catchall"
+ MatchIsTouchpad "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev tablet catchall"
+ MatchIsTablet "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev touchscreen catchall"
+ MatchIsTouchscreen "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection' >/mnt/etc/X11/xorg.conf.d/10-evdev.conf
+ # Xorg hardware is autodetected, so no module information provided
+ [ -z "${xmodule}" ] && \
+ sed "/Section \"Device\"/,/EndSection/d" -i ${xfc}
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/lib/X11
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/lib/X11/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm
new file mode 100644
index 00000000..f0c3ebb8
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm
@@ -0,0 +1,63 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_10.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_10;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # suse specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ # use the old kbd keyboard driver instead of evdev
+ sed "s/\"evdev\"/,/\"kbd\"/" -i ${xfc}
+ # relevant for older xservers only: check for kind of xorg module used
+ # and patch the i8,9XX VGA BIOS if needed
+ #if strinfile '"i810"' $xfc && [ -f /etc/hwinfo.display ] ; then
+ # highres=$(sort -run /etc/hwinfo.display|grep -i x -m 1)
+ # 915resolution -l|sed -n "s/Mode //;/32 bits/p" > /tmp/915res
+ # strinfile ${highres} /tmp/915res || {
+ # 915resolution $(grep -i x -m 1 /tmp/915res|sed "s/\ :.*//") $(echo \
+ # $highres|sed "s/x/\ /") 2>&1 >/dev/null;
+ # # for some reason the above does not work for a Dell laptop with Intel
+ # # 855 chipset, so add another mode too
+ # 915resolution 3c $(echo $highres|sed "s/x/\ /") 2>&1 >/dev/null; }
+ #fi
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm
new file mode 100644
index 00000000..4117c421
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm
@@ -0,0 +1,360 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_0.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_0;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+# This function needs wget installed
+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 );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ 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);
+
+ my $url = "ftp://download.nvidia.com/opensuse/$version/$chost";
+
+ print " * Downloading NVIDIA rpm from ftp://download.nvidia.com/opensuse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $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;
+ $rpm[0] =~ /nvidia-gfxG01-kmp-$ksuffix-(.*?)_(.*?)-.*?\.$chost.rpm/;
+
+ my $nv_kver = $2;
+ $nv_kver =~ s/_/-/g;
+
+ if($rpm == 0) {
+ print "Could not download nvidia kernel module rpm!";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/nvidia/modules/")
+ {
+ mkdir("$repopath/nvidia/modules/");
+ }
+
+
+ # since kernel 2.6.25.20-0.1 there has to be a call to ld
+ # ld -r -m elf_i386 -o ../modules/nvidia.ko lib/modules/2.6.25.20-0.4-pae/updates/{nv-kernel,nv-linux}.o
+
+ my $nv_path = glob "$tmpdir/lib/modules/*-$ksuffix/updates/";
+ if ( -f "$nv_path/nv-kernel.o" ) {
+ # we have to link our kernel module here
+ system("ld -r -m elf_i386 -o $nv_path/nvidia.ko $nv_path/{nv-kernel,nv-linux}.o");
+ }
+
+ copyFile("$nv_path/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 -t2 -T2 $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-nvidiaG01-$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);
+
+}
+
+# this function needs wget
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/ati/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/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);
+
+ my $url = "http://www2.ati.com/suse/$version/";
+
+ print " * Downloading ATI rpm from http://www2.ati.com/suse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/repodata/primary.xml.gz >/dev/null 2>&1");
+
+ my $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$kver_ati.*?$chost.rpm"`;
+ chomp($url2);
+
+ if($url2 eq '') {
+ # Taking more general kernel version (minus local suse version)
+ my $newkernvers = '';
+ if($kver_ati =~ /(.*)_(.*?)$/) {
+ # if we have a match here
+ $newkernvers = $1;
+ }
+ else {
+ # just try the old method
+ $newkernvers = substr $kver_ati, 0, -4;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+ else {
+ # Minus local Suse version number - hoping, there was no ABI change
+ if($newkernvers =~ /(.*).(.*?)$/) {
+ # here we try with yet another older kernel version
+ $newkernvers = $1;
+ }
+ else {
+ $newkernvers = substr $kver_ati, 0, -7;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+
+ }
+ }
+
+# print "KVER = $kver; CHOST = $chost; ksuffix=$ksuffix\n";
+# system("bash");
+
+ if($url2 eq '') {
+ print "No ATI module rpm for the chosen kernel version ($kver) found! Exiting!\n";
+ return;
+ }
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ my @rpm = glob "$tmpdir/ati-fglrxG01-kmp-$ksuffix*$chost.rpm";
+ my $rpm = @rpm;
+
+ if($rpm == 0) {
+ print "Could not download ATI kernel module rpm (for kernel $kver)!\n";
+ print "Consider downgrading your Kernel! \nTrying package-install!\n";
+ $self->installAtiOldStyle(@_);
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir("$repopath/ati/modules/");
+ }
+ copyFile("$tmpdir/lib/modules/$kver*-$ksuffix/updates/fglrx.ko",
+ "$repopath/ati/modules");
+
+ my @versions = split(/-/, $rpm[0]);
+ my @ati_versions = split('_',$versions[5]);
+ my $ati_version = $ati_versions[0];
+
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/x11-video-fglrxG01-$ati_version-.*?.$chost.rpm"`;
+ chomp($url2);
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-fglrxG01-$ati_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print " Could not download x11-video-fglrxG01-$ati_version*.rpm!\n";
+ print " Exiting ATI 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/ati/");
+ system("mv $tmpdir/etc $repopath/ati/");
+ if( ! -d "/usr/X11R6/lib/modules/dri/" ) {
+ system("mkdir -p /usr/X11R6/lib/modules/dri/");
+ }
+ symlink("$repopath/ati/usr/lib/dri/fglrx_dri.so","/usr/X11R6/lib/modules/dri/fglrx_dri.so");
+
+ 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 = getKernelVersionForDistro("/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;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm
new file mode 100644
index 00000000..ab543549
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm
@@ -0,0 +1,361 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_1.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_1;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+# This function needs wget installed
+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 );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ 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);
+
+ my $url = "ftp://download.nvidia.com/opensuse/$version/$chost";
+
+ print " * Downloading NVIDIA rpm from ftp://download.nvidia.com/opensuse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $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;
+ $rpm[0] =~ /nvidia-gfxG01-kmp-$ksuffix-(.*?)_(.*?)-.*?\.$chost.rpm/;
+
+ my $nv_kver = $2;
+ $nv_kver =~ s/_/-/g;
+
+ if($rpm == 0) {
+ print "Could not download nvidia kernel module rpm!";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/nvidia/modules/")
+ {
+ mkdir("$repopath/nvidia/modules/");
+ }
+
+
+ # since kernel 2.6.25.20-0.1 there has to be a call to ld
+ # ld -r -m elf_i386 -o ../modules/nvidia.ko lib/modules/2.6.25.20-0.4-pae/updates/{nv-kernel,nv-linux}.o
+
+ my $nv_path = glob "$tmpdir/lib/modules/*-$ksuffix/updates/";
+ if ( -f "$nv_path/nv-kernel.o" ) {
+ # we have to link our kernel module here
+ system("ld -r -m elf_i386 -o $nv_path/nvidia.ko $nv_path/{nv-kernel,nv-linux}.o");
+ }
+
+ copyFile("$nv_path/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 -t2 -T2 $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-nvidiaG01-$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);
+
+}
+
+
+# this function needs wget
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/ati/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/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);
+
+ my $url = "http://www2.ati.com/suse/$version/";
+
+ print " * Downloading ATI rpm from http://www2.ati.com/suse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/repodata/primary.xml.gz >/dev/null 2>&1");
+
+ my $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$kver_ati.*?$chost.rpm"`;
+ chomp($url2);
+
+ if($url2 eq '') {
+ # Taking more general kernel version (minus local suse version)
+ my $newkernvers = '';
+ if($kver_ati =~ /(.*)_(.*?)$/) {
+ # if we have a match here
+ $newkernvers = $1;
+ }
+ else {
+ # just try the old method
+ $newkernvers = substr $kver_ati, 0, -4;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+ else {
+ # Minus local Suse version number - hoping, there was no ABI change
+ if($newkernvers =~ /(.*).(.*?)$/) {
+ # here we try with yet another older kernel version
+ $newkernvers = $1;
+ }
+ else {
+ $newkernvers = substr $kver_ati, 0, -7;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+
+ }
+ }
+
+# print "KVER = $kver; CHOST = $chost; ksuffix=$ksuffix\n";
+# system("bash");
+
+ if($url2 eq '') {
+ print "No ATI module rpm for the chosen kernel version ($kver) found! Exiting!\n";
+ return;
+ }
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ my @rpm = glob "$tmpdir/ati-fglrxG01-kmp-$ksuffix*$chost.rpm";
+ my $rpm = @rpm;
+
+ if($rpm == 0) {
+ print "Could not download ATI kernel module rpm (for kernel $kver)!\n";
+ print "Consider downgrading your Kernel! \nTrying package-install!\n";
+ $self->installAtiOldStyle(@_);
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir("$repopath/ati/modules/");
+ }
+ copyFile("$tmpdir/lib/modules/$kver*-$ksuffix/updates/fglrx.ko",
+ "$repopath/ati/modules");
+
+ my @versions = split(/-/, $rpm[0]);
+ my @ati_versions = split('_',$versions[5]);
+ my $ati_version = $ati_versions[0];
+
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/x11-video-fglrxG01-$ati_version-.*?.$chost.rpm"`;
+ chomp($url2);
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-fglrxG01-$ati_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print " Could not download x11-video-fglrxG01-$ati_version*.rpm!\n";
+ print " Exiting ATI 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/ati/");
+ system("mv $tmpdir/etc $repopath/ati/");
+ if( ! -d "/usr/X11R6/lib/modules/dri/" ) {
+ system("mkdir -p /usr/X11R6/lib/modules/dri/");
+ }
+ symlink("$repopath/ati/usr/lib/dri/fglrx_dri.so","/usr/X11R6/lib/modules/dri/fglrx_dri.so");
+
+ 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 = getKernelVersionForDistro("/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;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
new file mode 100644
index 00000000..5cddcef0
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
@@ -0,0 +1,53 @@
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_2.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_2;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/lib/X11
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/lib/X11/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..057cf138
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,96 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+# needs to be implemented ...
+sub XserverPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/X11/xorg.openslx',
+ paths => [
+ '/usr/bin',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ # overwriting script part from Base.pm
+ $script = unshiftHereDoc(<<' End-of-Here');
+ # Ubuntu specific extension to stage3 xserver.sh
+ echo -e "# ${xfc#/mnt*}\n# autogenerated X hardware configuration by \
+ the xserver plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN \
+ INSTEAD" >${xfc}
+ # using variables defined in XX_xserver.sh
+ echo -e "${x_modpath}\n${x_srvflags}\n${x_modules}" >>${xfc}
+ echo "${x_keyboard}" | sed "s/kbd/evdev/" >>${xfc}
+ echo -e "${x_mouse}\n${x_monitor}\n${x_screen}" >>${xfc}
+ echo "${x_srvlayout}" | sed "/ Screen /d" >>${xfc}
+ testmkd /mnt/etc/X11/xorg.conf.d
+ testmkd /mnt/var/run/xauth
+ testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ End-of-Here
+
+ 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/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
new file mode 100644
index 00000000..1fa88446
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
@@ -0,0 +1,73 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_8.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_8;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # Ubuntu specific extension to stage3 xserver.sh
+ # use the old kbd keyboard driver instead of evdev
+ sed "s/\"evdev\"/,/\"kbd\"/" -i ${xfc}
+ testmkd /mnt/var/run/xauth
+ testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ End-of-Here
+
+ 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/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
new file mode 100644
index 00000000..80dccbc9
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_9.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_9;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Ubuntu_8);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm b/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
new file mode 100644
index 00000000..b172dc22
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
@@ -0,0 +1,396 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::xserver;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+use File::Basename;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'xserver',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ This plugin tries to configure the local Xorg-Server and
+ integrates binary graphics drivers (closed sourced) into the system.
+ Notice that you need to have kernel-headers installed to work properly.
+ in some cases. You need to download the driver packages yourself and
+ supply the download folder into the pkgpath option.
+ End-of-Here
+ precedence => 80,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'xserver::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'xserver::ddcinfo' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin use the ddcinfo (if available) for
+ the monitor/tft setup? Might help in scenarios with resolutions
+ configured much lower than physically possible. (0 ignore, 1 use)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 ignore ddcinfo, 1 use ddcinfo if available',
+ default => '0',
+ },
+ 'xserver::driver' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ force to use defined driver
+ End-of-Here
+ content_regex => undef,
+ content_descr => 'force to use defined driver',
+ default => undef,
+ },
+ 'xserver::prefnongpl' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin use the non-gpl drivers for some graphic
+ adaptors if available (0 prefer gpl, 1 use the nongpl)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 prefer gpl, 1 use the nongpl',
+ default => '0',
+ },
+ 'xserver::multihead' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin configure multi-head setups of Xorg
+ for different scenarios and dynamically added displays
+ (not implemented yet)
+ End-of-Here
+ content_regex => undef,
+ content_descr => '',
+ default => '1',
+ },
+
+ # plugin specific attributes start here ...
+
+ # stage1
+ # Currently not needed in scenarios where distro specific packages are
+ # available, but for example in SUSE 10.2 we use this method
+ # -> provide downloaded packages here.
+ 'xserver::pkgpath' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Path to downloaded ATI or Nvidia package
+ End-of-Here
+ content_regex => qr{^.+$}, # not empty
+ content_descr => 'Path to Nvidia or ATI packages',
+ default => '/root/xserver-pkgs',
+ },
+ 'xserver::ati' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the non-gpl ATI drivers be available (installed in vendor-OS - not implemented yet)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1"',
+ default => '0',
+ },
+ 'xserver::nvidia' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the non-gpl NVidia drivers be available (installed in vendor-OS - not implemented yet)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1"',
+ default => '0',
+ },
+ #'xserver::matrox' => {
+ # applies_to_vendor_os => 1,
+ # description => unshiftHereDoc(<<' End-of-Here'),
+ # should the non-gpl Matrox drivers (e.g. for the Parhelia) be
+ # available (installed in vendor-OS)?
+ # End-of-Here
+ # content_regex => qr{^0|1$},
+ # content_descr => '"0", "1"',
+ # default => '0',
+ #},
+ };
+}
+
+
+sub preInstallationPhase()
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+ $self->{vendorOsPath} = $info->{'vendor-os-path'};
+
+
+ my $pkgpath = $self->{attrs}->{'xserver::pkgpath'};
+ $pkgpath ||= "";
+ my $installAti = $self->{attrs}->{'xserver::ati'};
+ my $installNvidia = $self->{attrs}->{'xserver::nvidia'};
+
+ if (! -d $pkgpath && ($installAti == 1 || $installNvidia == 1)) {
+ print "\n\n * xserver::pkgpath: no such directory!\n";
+ print " * xserver plugin can only install ATI or Nvidia driver\n";
+ print " via operating system packaging (e.g. != SuSE-10.2)!\n";
+ # exit 1 => xserver plugin is not getting installed because ati
+ # or nvidia where selected but are not installable!
+ # exit 1;
+ }
+
+ if (-d $pkgpath && ($installNvidia == 1 || $installAti == 1)) {
+ system("cp -r $pkgpath $self->{pluginRepositoryPath}/packages");
+ }
+
+}
+
+
+sub installationPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to install required files into the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ # ehh... every plugin has it's own different installationPhase
+ # variable definition?
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ # the openslx base path (/opt/openslx) bind-mounted into the chroot
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ # the openslx config path (/etc/opt/openlsx) bind-mounted into the
+ # chroot
+ my $attrs = $info->{'plugin-attrs'};
+ # attributes in effect for this installation
+ my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'};
+
+ # write the distro specific extension (inclusion) of XX_xserver.sh
+ my $script = $self->{distro}->setupXserverScript($pluginRepoPath);
+ spitFile("$pluginRepoPath/xserver.sh", $script);
+
+ # if defined: build nvidia or ati binarys
+ my $pluginFilesPath =
+ "$openslxBasePath/lib/plugins/$self->{'name'}/files";
+ my $installationPath = "$pluginRepoPath/";
+ my $binDrivers = 0;
+ my $engine = $self->{'os-plugin-engine'};
+
+ # removeLinks is to remove Links to the files
+ # TODO: In future versions this call can be removed - deprecated version
+ $self->removeLinks();
+
+ if ($attrs->{'xserver::nvidia'} == 1 || $attrs->{'xserver::ati'} == 1 ) {
+ if($vendorOSName =~ /.*?ubuntu.*?/i)
+ {
+ if($vendorOSName =~ /.*?8.10|9.04|9.10.*?/i)
+ {
+ copyFile("$pluginFilesPath/ubuntu-ng-gfx-install.sh",
+ "$installationPath");
+ rename("$installationPath/ubuntu-ng-gfx-install.sh",
+ "$installationPath/ubuntu-gfx-install.sh");
+ }
+ else
+ {
+ copyFile("$pluginFilesPath/ubuntu-gfx-install.sh", "$installationPath");
+ }
+ }
+ $binDrivers = 1;
+ }
+ if ($attrs->{'xserver::ati'} == 1 ) {
+ $self->{distro}->installAti($pluginRepoPath,"packages");
+ }
+ if ($attrs->{'xserver::nvidia'} == 1 ) {
+ $self->{distro}->installNvidia($pluginRepoPath,"packages");
+ }
+
+ if ($binDrivers == 1) {
+ $self->ldconf($info);
+ system("chmod -R 755 $installationPath");
+ }
+
+ return;
+}
+
+sub removalPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to uninstall no longer required files from the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+
+
+ # TODO (in far future): Remove - linking is deprecated
+ # Make sure nobody has installed the old plugin version
+ $self->removeLinks();
+
+ return;
+}
+
+
+
+# Create ld.so.conf for the binary drivers
+sub ldconf
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $attrs = $info->{'plugin-attrs'};
+ my $ldincl = $info->{'plugin-repo-path'}.'/';
+ my $ldpl = "/etc/ld.conf.preload";
+ my $ldconf = "/etc/ld.so.conf";
+ my $ldcache = "";
+
+ if( -d $ldincl.'nvidia/') {
+
+ ## 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);
+ }
+
+
+ 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);
+ }
+}
+
+
+# deprecated
+# removes linked libraries from /usr/lib/
+sub removeLinks
+{
+ 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";
+
+ # get all previously installed links
+ my @linkedFiles =
+ `find $instFolders -lname "$divertFolder*" -o -lname "$pluginFolder*" `;
+
+
+ # also remove _MESA backup files
+ my @backupFiles =
+ `find $instFolders -name "*_MESA.so*"`;
+ my $origfile = '';
+ for my $file (@backupFiles) {
+ $origfile = $file;
+ $file =~ s/_MESA//;
+ rename($origfile,$file);
+ }
+ unlink "/usr/lib/libGL.so", "/usr/lib/libGL.so.1";
+ symlink "/usr/lib/libGL.so.1.2", "/usr/lib/libGL.so.1";
+ symlink "/usr/lib/libGL.so.1.2", "/usr/lib/libGL.so";
+
+
+ foreach my $file (@linkedFiles) {
+ chomp($file);
+ unlink $file;
+ }
+
+ # this should not print any file at all ;-(
+ my @files = `find $instFolders -lname "$divertFolder*" -o -lname "$pluginFolder*" `;
+ if ( $#files > 0 ) {
+ print "Links were not removed properly! Exiting!\n";
+ my $bla;
+ foreach (@files) {
+ chomp($bla = $_);
+ print $bla;
+ }
+ exit(1);
+ }
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/XX_xserver.sh b/src/os-plugins/plugins/xserver/XX_xserver.sh
new file mode 100644
index 00000000..1b757901
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/XX_xserver.sh
@@ -0,0 +1,351 @@
+# Copyright (c) 2008 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'xserver' plugin - the runlevel script setting up the Xorg
+# configuration and checking for 3D capabilities and non-gpl drivers
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# defining a set of stanard configuration blocks
+x_modpath='Section "Files"
+# ModulePath "/usr/lib/xorg/modules/,/usr/lib64/xorg/modules/"
+EndSection'
+x_srvflags='Section "ServerFlags"
+ Option "AllowMouseOpenFail"
+ Option "AllowEmptyInput" "false"
+ Option "blank time" "5"
+ Option "standby time" "10"
+ Option "suspend time" "15"
+ Option "off time" "20"
+EndSection'
+x_modules='Section "Module"
+ Load "i2c"
+ Load "bitmap"
+ Load "ddc"
+ Load "extmod"
+ Load "freetype"
+ Load "int10"
+ Load "vbe"
+ Load "glx"
+ Load "dri"
+EndSection'
+x_mouse='Section "InputDevice"
+ Identifier "Generic Mouse"
+ Driver "mouse"
+# Option "Device" "/dev/input/mice"
+# Option "Protocol" "ImPS/2"
+# Option "ZAxisMapping" "4 5"
+# Option "Emulate3Buttons" "true"
+ Option "CorePointer"
+EndSection'
+x_keyboard='Section "InputDevice"
+ Identifier "Generic Keyboard"
+ Driver "evdev"
+ Option "CoreKeyboard"
+ Option "XkbRules" "xorg"
+ Option "XkbModel" "pc105"
+ Option "XkbLayout" "us"
+EndSection'
+x_videocard='Section "Device"
+ Identifier "Generic Video Card"
+ Driver "vesa"
+# BusID "PCI:xx" #especially needed for fglrx
+EndSection'
+x_monitor='Section "Monitor"
+ Identifier "Generic Display"
+ Option "DPMS"
+# Modelname "could be enabled via xserver::ddcinfo attribute"
+# Vertrefresh ...
+# Horizsync ...
+# DisplaySize ...
+EndSection'
+x_screen='Section "Screen"
+ Identifier "Default Screen"
+ Device "Generic Video Card"
+ Monitor "Generic Display"
+ DefaultDepth 24
+# SubSection "Display"
+# Depth 24
+# Modes "1024x768" "800x600"
+# EndSubSection
+EndSection'
+x_srvlayout='Section "ServerLayout"
+ Identifier "Default Layout"
+ Screen "Default Screen"
+ InputDevice "Generic Keyboard"
+ InputDevice "Generic Mouse"
+EndSection'
+x_dri='Section "DRI"
+ Mode 0666
+EndSection'
+# Xorg configuration file location
+xfc="/mnt/etc/X11/xorg.conf"
+
+# read the central configuration file (fixme: should the keyboard layout
+# defined within the xserver plugin settings - probably not, dvs)
+if [ -e /initramfs/machine-setup ] ; then
+ . /initramfs/machine-setup
+else
+ error " The central configuration file 'machine-setup' (produced by the \
+slxconfig-demuxer\n and transported via fileget) is not present" nonfatal
+fi
+
+if [ -e /etc/slxsystem.conf ]; then
+ . /etc/slxsystem.conf
+fi
+
+# directory for libGL, DRI library links to point to proper library set
+# depending on the hardware environment
+glliblinks="/mnt/var/X11R6/lib/"
+testmkd ${glliblinks}
+
+# check for the existance of plugin configuration and non-existance of an
+# admin provided config file in ConfTGZ
+if [ -e /initramfs/plugin-conf/xserver.conf -a \
+ ! -f /rootfs/etc/X11/xorg.conf ]; then
+ . /initramfs/plugin-conf/xserver.conf
+ # check if driver set via xserver_driver
+ # if so check for xserver_prefnongpl and xserver_driver because you want to
+ # force driver even if xserver_prefnongpl=0
+ # eg: [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ if [ -n "$xserver_driver" ]; then
+ if `grep -qi "Server Module" /etc/hwinfo.gfxcard`; then
+ sed -i "s,XFree86.*,FORCED XFree86 v4 Server Module: ${xserver_driver}," \
+ /etc/hwinfo.gfxcard
+ echo -e "\n# File modified by $1" >> /etc/hwinfo.gfxcard
+ echo "# Reason: attribute server_driver set to ${xserver_driver}" \
+ >> /etc/hwinfo.gfxcard
+ else
+ echo -e "\n# File modified by $1" >> /etc/hwinfo.gfxcard
+ echo "# Reason: attribute server_driver set to ${xserver_driver}" \
+ >> /etc/hwinfo.gfxcard
+ echo "FORCED XFree86 v4 Server Module: ${xserver_driver}" >> /etc/hwinfo.gfxcard
+ fi
+ fi
+ # do not start any configuration if the admin provided a preconfigured
+ # xorg.conf in /rootfs/etc/X11/xorg.conf
+ if [ $xserver_active -ne 0 -a ! -f /rootfs/${xfc#/mnt} ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xserver' os-plugin ...";
+ xmodule=$(grep -i -m 1 "XFree86 v4 Server Module" /etc/hwinfo.gfxcard | \
+ sed "s/.*v4 Server Module: //")
+ # proprietary ATI/NVidia modules listed a different way with hwinfo
+ [ -z "$xmodule" ] || error "${hcfg_hwsetup}" nonfatal
+
+ ######################################################################
+ # begin proprietary drivers section (xorg.conf part)
+ ######################################################################
+
+ if $(grep -iq -m 1 'Module: fglrx' /etc/hwinfo.gfxcard) && \
+ [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ then
+ # we have an ati card here
+ PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/ati"
+ if [ -f /mnt${PLUGIN_ROOTFS}/usr/X11R6/lib/dri/fglrx_dri.so -o \
+ -f /mnt${PLUGIN_ROOTFS}/usr/lib/dri/fglrx_dri.so ]; then
+
+ # this will be written before standard module path into xorg.conf
+ MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\
+${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
+ xmodule="fglrx"
+ PLUGIN_PATH="/mnt/${PLUGIN_ROOTFS}"
+
+ # impossible to load it directly via stage3 insmod - yes, somehow this is too big
+ chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/fglrx.ko
+
+ # workaround for bug #453 (for some ati graphics cards)
+ if [ $? -gt 0 -a "${slxconf_distro_name}" = "ubuntu" ]; then
+ xmodule="radeon"
+ MODULE_PATH="/usr/lib/xorg/modules/,/usr/X11R6/lib/xorg/modules/"
+ else
+
+ # we need some database for driver initialization
+ cp -r "${PLUGIN_PATH}/etc/ati" /mnt/etc
+
+ if [ "${slxconf_distro_name}" = "ubuntu" ]; then
+ echo "${PLUGIN_ROOTFS}/usr/lib/libGL.so.1" >> /mnt/etc/ld.so.preload
+ fi
+
+ # if fglrx_dri.so is linked wrong -> we have to link it here
+ if [ "1" -eq "$( ls -l /mnt/usr/lib/dri/fglrx_dri.so \
+ | grep -o "/var/X11R6.*so$" | wc -l )" ]; then
+ ln -s ${PLUGIN_ROOTFS}/usr/lib/dri/fglrx_dri.so \
+ ${glliblinks}dri/fglrx_dri.so
+ fi
+ BUSID=$(grep -m1 -i " SysFS BusID: .*" /etc/hwinfo.gfxcard | \
+ awk -F':' '{print "PCI:"$3":"$4}' | sed -e 's,\.,:,g')
+ echo -e "\t${PLUGIN_ROOTFS}/usr/bin/aticonfig --initial &>/dev/null"\
+ >> /mnt/etc/init.d/boot.slx
+ ATI=1
+ fi # if kernel module not loaded properly
+ fi
+ elif $(grep -iq -m 1 'Module: nvidia' /etc/hwinfo.gfxcard) && \
+ [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ then
+ # we have an nvidia card here
+ NVIDIA=1
+ PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/nvidia"
+ MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\
+${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
+ xmodule="nvidia"
+ PLUGIN_PATH="/mnt${PLUGIN_ROOTFS}"
+
+ # if we can't find the nongpl kernel module, use gpl xorg
+ # nvidia driver
+ if [ -e ${PLUGIN_PATH}/modules/nvidia.ko ]; then
+ # sometimes the kernel module needs agpgart
+ modprobe agpgart
+ # insert kernel driver
+ chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/nvidia.ko
+
+
+ # workaround for bug #453 (Xorg does not start with ld.so.preload)
+ if [ "${slxconf_distro_name}" = "ubuntu" -a "${xmodule}" != "nvidia" ]; then
+ echo "${PLUGIN_ROOTFS}/usr/lib/libGL.so.1" >> /mnt/etc/ld.so.preload
+ fi
+
+ else
+ xmodule="nv"
+ fi
+
+ fi
+
+ ######################################################################
+ # end proprietary drivers xorg.conf section
+ ######################################################################
+
+ # write the xorg.conf completely or in files needed (depending on
+ # distro version)
+ # determine keyboard setup (fill XKEYBOARD)
+ localization "${country}"
+
+ # run distro specific generated stage3 script which uses variables
+ # defined in the beginning of this script like ${x_*}, ${xfc}
+ [ -e /mnt/opt/openslx/plugin-repo/xserver/xserver.sh ] && \
+ . /mnt/opt/openslx/plugin-repo/xserver/xserver.sh
+
+ # set nodeadkeys for special layouts
+ if [ ${XKEYBOARD} = "de" ]; then
+ sed -e '/\"XkbLayout\"/a\\ \ Option "XkbVariant" "nodeadkeys"' \
+ -i ${xfc}
+ fi
+ # if a synaptic touchpad is present, add it to the device list
+ if grep -q -E "ynaptics" /etc/hwinfo.mouse || \
+ dmesg | grep -q -E "ynaptics" ; then
+ sed -e '/\"CorePointer\"/ {
+a\
+EndSection\
+Section "InputDevice"\
+ Identifier "Synaptics TP"\
+ Driver "synaptics"\
+ Option "Device" "/dev/input/mice"\
+ Option "SendCoreEvents" "true"
+}' -e '/Device "Generic Mouse"/ {
+a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents"
+}' -i ${xfc}
+ fi
+
+ # ModulePath for proprietary drivers (otherwise disabled)
+ if [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq "1" ]; then
+ sed -e "s,# ModulePath \", ModulePath \"${MODULE_PATH},g" \
+ -i ${xfc}
+ fi
+
+ ############################################
+ # Copy the appropriate ld.so.cache file
+ ############################################
+ if [ "${xmodule}" = "fglrx" -o "${xmodule}" = "nvidia" ]; then
+ cp ${PLUGIN_PATH}/ld.so.cache /mnt/etc/ld.so.cache
+
+ # just in case somebody needs to run ldconfig - insert GL-Libs at the beginning
+ sed -e "1s,^,include ${PLUGIN_ROOTFS}/ld.so.conf\n,g" -i /mnt/etc/ld.so.conf
+
+ if [ "${xmodule}" = "nvidia" ]; then
+ sed -i "s,\(Driver.*\"nvidia\"\),\1\n Option \"NoLogo\" \"True\"," ${xfc}
+ fi
+ fi
+
+ # check if tablet hardware available, read device information from file
+ if [ -e /etc/tablet.conf ]; then
+ . /etc/tablet.conf
+ echo -e 'Section "InputDevice"
+ Driver "wacom"
+ Identifier "Stylus"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "stylus"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Pad"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "pad"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Eraser"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "eraser"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Cursor"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "cursor"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection' >> ${xfc}
+ sed -e "s,/dev/input/wacom,/dev/${wacomdev}," \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Stylus" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Pad" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Cursor" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Eraser" "SendCoreEvents"' \
+ -i ${xfc}
+ fi
+
+ # some configurations produce no proper screen resolution without
+ # Horizsync and Vertrefresh set (more enhancements might be needed for
+ # really old displays like CRTs)
+ if [ $xserver_ddcinfo -ne 0 ] ; then
+ # read /etc/hwinfo.display started at "runinithook '00-started'"
+ vert=$(grep -m 1 "Vert.*Range:" /etc/hwinfo.display | \
+ sed 's|.*Range:\ ||;s|\ Hz||')
+ horz=$(grep -m 1 "Hor.*Range:" /etc/hwinfo.display | \
+ sed 's|.*Range:\ ||;s|\ kHz||')
+ modl=$(grep -m 1 " Model: " /etc/hwinfo.display | \
+ sed 's|.*Model:\ ||;s|"||g')
+ size="$(grep -m 1 " Size: " /etc/hwinfo.display | \
+ sed 's|.*ize:\ ||;s|\ mm||;s|x|\ |')"
+ modes=$(grep -i "Resolution: .*@" /etc/hwinfo.display | \
+ awk '{print $2}'| sort -unr| awk -F '@' '{print "\"" $1 "\""}'|\
+ tr "\n" " ")
+ [ -n "$vert" -a -n "$horz" ] && \
+ sed -e "s|# Horizsync.*| Horizsync $horz|;\
+ s|# Vertrefre.*| Vertrefresh $vert|;\
+ s|# Modelname.*| Modelname \"$modl\"|" -i ${xfc}
+ [ -n "$size" ] && \
+ sed -e "s|# DisplaySi.*| DisplaySize $size|" -i ${xfc}
+ [ -n "$modes" ] && \
+ sed -e "s|# SubSection.*| SubSection \"Display\"|;\
+ s|# Depth 24.*| Depth 24|;\
+ s|# Modes.*| Modes $modes|;\
+ s|# EndSubSection.*| EndSubSection|;" -i ${xfc}
+
+ fi
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'xserver' os-plugin ..."
+
+ fi
+elif [ ! -e /initramfs/plugin-conf/xserver.conf ]; then
+ [ $DEBUGLEVEL -gt 2 ] && \
+ echo "No configuration file found for xserver plugin."
+fi
diff --git a/src/os-plugins/plugins/xserver/files/README b/src/os-plugins/plugins/xserver/files/README
new file mode 100644
index 00000000..c13d9570
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/README
@@ -0,0 +1,77 @@
+Some development notes
+======================
+
+
+Infos about ati-packages:
+Most are identical, even when 64bit packages have a different name
+Only a couple of cards have its own special package. We need to
+investigate, if they are different or one package works for all.
+
+It seems - only for the FireMV 2200 PCI graphics card, they offer an older
+version (8.25) of the unified fglrx-driver. For the FirMV PCIE-Card they
+offer a more recent Version (8.5).
+By the time of writing the drivers were at version 8.7
+
+From the ATI-FAQ:
+
+Q2: Which ATI graphics cards can use this driver?
+A2: The ATI Proprietary Linux driver currently supports Radeon 8500 and
+later AGP or PCI Express graphics products, as well as ATI FireGL 8700
+and later products. We do not currently plan to include support for any
+products earlier than this.
+
+Support for earlier graphics card can be achieved by "radeon" or "ati" drivers!
+
+===============================================================================
+
+Infos about nvidia packages:
+they seem to differ much more as ati if you search directly for a
+specific graphic card. But if you take a look on
+http://www.nvidia.com/object/unix.html there seem to be just 3 different
+ersions - all for different architectures (ia32, ia64, amd64)
+
+
+
+Supported graphics cards can be read from the nvidia-documentation
+
+For the 173.14.12-NVIDIA-Driver go to
+http://www.nvidia.com/object/linux_display_ia32_173.14.12.html
+and click on "Supported Products List" on the right side
+
+(below each unified driver a line to symbolize the evolution of
+ drivers - correct me if I'm wrong)
+
+173.14.12 driver: GeForce FX 5100 & all newer supported
+ |---------------------------------->
+ 71.86.06 driver: Riva TNT - GeForce 6800 Ultra
+|---------------|
+ 96.43.07 driver: some GeForce3 - GeForce 7900 ??
+ |---------------|
+
+The Question is, wether we need to support older graphics cards.
+Probably we don't need to bother because the user can download right
+driver package for his needs - almost the same interfaces for the installer...
+
+
+
+===============================================================================
+Taken from the readme on
+http://us.download.nvidia.com/XFree86/Linux-x86/96.43.07/README/README.txt
+
+since 96.43.07 no longer supported in the unified driver:
+
+ NVIDIA chip name Device PCI ID
+ ---------------------------------- ----------------------------------
+ RIVA TNT 0x0020
+ RIVA TNT2/TNT2 Pro 0x0028
+ RIVA TNT2 Ultra 0x0029
+ Vanta/Vanta LT 0x002C
+ RIVA TNT2 Model 64/Model 64 Pro 0x002D
+ Aladdin TNT2 0x00A0
+ GeForce 256 0x0100
+ GeForce DDR 0x0101
+ Quadro 0x0103
+ GeForce2 GTS/GeForce2 Pro 0x0150
+ GeForce2 Ti 0x0151
+ GeForce2 Ultra 0x0152
+ Quadro2 Pro 0x0153
diff --git a/src/os-plugins/plugins/xserver/files/ati-install.sh b/src/os-plugins/plugins/xserver/files/ati-install.sh
new file mode 100755
index 00000000..662b96bf
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ati-install.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+cd /opt/openslx/plugin-repo/xserver
+
+DISTRO=$1
+case $DISTRO in
+
+ ubuntu-9.10*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-9.04*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-8.10*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-*)
+ ./ubuntu-gfx-install.sh ati ${DISTRO}
+ ;;
+
+ suse-*)
+ ./suse-gfx-install.sh ati ${DISTRO}
+ ;;
+esac
diff --git a/src/os-plugins/plugins/xserver/files/nvidia-install.sh b/src/os-plugins/plugins/xserver/files/nvidia-install.sh
new file mode 100755
index 00000000..aa2b2269
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/nvidia-install.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+
+##########################################################
+# Installs NVIDIA binary drivers into openslx plugin-repo
+##########################################################
+PLUGIN_PATH="/opt/openslx/plugin-repo/xserver"
+
+# we could easily pass this information via calling stage1 script and do not
+# need to find it our here ...
+DISTRO=$1
+
+
+# for development we take the only kernel version from normal systems
+if [ -L /boot/vmlinuz ]; then
+ KVERS=$(ls -l /boot/vmlinuz | awk -F "->" '{print $2}'| grep -P -o "2.6.*")
+else
+ KVERS=$(ls /boot/vmlinuz-* | head -n1 | awk -F "->" '{print $2}' | grep -P -o "2.6.*" )
+fi
+
+
+#change to plugin path
+cd ${PLUGIN_PATH}
+
+case ${DISTRO} in
+ ubuntu-9.10*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu-9.04*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu-8.10*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu*)
+ ./ubuntu-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ suse-1*)
+ ./suse-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ # general purpose nvidia installer script
+ *)
+ echo "* Running general NVidia installer (expected in xserver::pkgpath)"
+ # unpack the nvidia installer; quickhack - expects just one package
+ echo " * Unpacking installer"
+ sh packages/NVIDIA-Linux-*.run -a -x >>nvidia-inst.log 2>&1
+ # prefix and paths should be matched more closely to each distro
+ # just demo at the moment ... but working at the moment
+ # without the kernel module
+ stdprfx=/opt/openslx/plugin-repo/xserver/nvidia
+
+ # backing up libglx.so and libGLcore.so
+ BACKUP_PATH=${stdprfx}/../mesa/usr/lib/xorg/modules/extensions
+ mkdir -p ${BACKUP_PATH}
+ if [ -f /usr/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/lib/xorg/modules/extensions/libGLcore.so ${BACKUP_PATH}
+ cp /usr/lib/xorg/modules/extensions/libglx.so ${BACKUP_PATH}
+ elif [ -f /usr/X11R6/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/X11R6/lib/xorg/modules/extensions/libglx.so ${BACKUP_PATH}
+ cp /usr/X11R6/lib/xorg/modules/extensions/libGLcore.so ${BACKUP_PATH}
+ touch ${BACKUP_PATH}/X11R6
+ fi
+ if [ -f /usr/lib/libGL.so.1.2 ]; then
+ cp /usr/lib/libGL.so.1.2 ${BACKUP_PATH}/../../..
+ elif [ -f /usr/X11R6/lib/libGL.so.1.2 ]; then
+ cp /usr/X11R6/lib/libGL.so.1.2 ${BACKUP_PATH}/../../..
+ touch ${BACKUP_PATH}/../../../X11R6
+ fi
+
+
+ # run the lib installer
+ echo " * Starting the library installer"
+ echo "Starting the lib installer" >>nvidia-inst.log
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N --no-abi-note \
+ --x-prefix=${stdprfx}/usr --x-library-path=${stdprfx}/usr/lib \
+ --x-module-path=${stdprfx}/usr/lib/xorg/modules \
+ --opengl-prefix=${stdprfx}/usr --utility-prefix=${stdprfx}/usr \
+ --documentation-prefix=${stdprfx}/usr --no-runlevel-check \
+ --no-rpms --no-x-check --no-kernel-module \
+ --log-file-name=nvidia-lib.log >>nvidia-inst.log 2>&1
+ # how to get an idea of the installed kernel?
+ # run the kernel module creator (should be done for every kernel!?)
+ kernel=${KVERS}
+ echo " * Trying to compile a kernel module for $kernel"
+ echo "Starting the kernel $kernel installer" >>nvidia-inst.log
+ # we need the .config file in /usr/src/linux or where ever!
+ # we need scripts/genksyms/genksyms compiled via make scripts in /usr/src/linux
+ # option available in newer nvidia packages
+ cd /usr/src/linux-${kernel%-*}
+ # in suse we have the config file lying there
+ cp /boot/config-${kernel} .config
+ ARCH=$(cat .config| grep -o CONFIG_M.86=y |tail -n1|grep -o "[0-9]86")
+ SUFFIX=${kernel##*-}
+ #cp -r /usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/ \
+ # /usr/src/linux-${kernel%-*}
+ make oldconfig >/dev/null 2>&1
+ make prepare >/dev/null 2>&1
+ cd - >/dev/null 2>&1
+ #/usr/src/linux-${kernel%-*}
+ addopts="--no-cc-version-check"
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N -K --no-abi-note \
+ --kernel-source-path=/usr/src/linux-${kernel%-*} \
+ --kernel-include-path=/usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/include \
+ -k ${kernel} \
+ --kernel-install-path=/opt/openslx/plugin-repo/xserver/nvidia/modules \
+ --no-runlevel-check --no-abi-note --no-rpms ${addopts} \
+ --log-file-name=nvidia-kernel.log >>nvidia-inst.log 2>&1
+ if [ $? -gt 0 ];then
+ echo "* kernel module built failed!"
+ fi
+ echo " * Have a look into the several *.log files in "
+ echo " stage1/${DISTRO}/plugin-repo/xserver"
+
+
+ # redo some unwanted changes of nvidia-installer
+ if [ -f ${BACKUP_PATH}/libglx.so ]; then
+ cp ${BACKUP_PATH}/libGLcore.so /usr/lib/xorg/modules/extensions
+ cp ${BACKUP_PATH}/libglx.so /usr/lib/xorg/modules/extensions
+ if [ -f ${BACKUP_PATH}/X11R6 ]; then
+ cp ${BACKUP_PATH}/libGLcore.so /usr/X11R6/lib/xorg/modules/extensions
+ cp ${BACKUP_PATH}/libglx.so /usr/X11R6/lib/xorg/modules/extensions
+ fi
+ fi
+ if [ -f ${BACKUP_PATH}/../../../libGL.so.1.2 ]; then
+ cp ${BACKUP_PATH}/../../../libGL.so.1.2 /usr/lib
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ elif [ -f ${BACKUP_PATH}/../../../X11R6 ]; then
+ cp ${BACKUP_PATH}/../../../libGL.so.1.2 /usr/X11R6/lib/
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ fi
+
+
+ ;;
+esac
+
+# set a proper return value to evaluate it in the calling script
+exit 0
diff --git a/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh b/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh
new file mode 100755
index 00000000..ac6713fb
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh
@@ -0,0 +1,330 @@
+#!/bin/bash
+
+#
+# supported:
+# nvidia:
+# * 10.2 (pkg-installer)
+# * 11.0 (zypper rpm packages)
+# * 11.1 (zypper rpm packages)
+#
+# ati:
+# * 10.2 (pkg-installer)
+# * 11.0 (zypper rpm packages)
+# * 11.1 (zypper rpm packages)
+#
+
+# not right any more - removed from script
+# is there any busybox in this environment
+#BUSYBOX="/mnt/opt/openslx//busybox/busybox"
+
+BASE=/opt/openslx/plugin-repo/xserver
+DISTRO=$2
+cd ${BASE}
+
+if [ -L /boot/vmlinuz ]; then
+ KSUFFIX=$(ls -l /boot/vmlinuz | grep -P -o -e "-[a-z]*$" )
+ KVERS=$(ls -l /boot/vmlinuz | awk -F "->" '{print $2}'| grep -P -o "2.6.*")
+else
+ KSUFFIX=$(ls /boot/vmlinuz-* | head -n1 | grep -P -o -e "-[a-z]*$" )
+ KVERS=$(ls /boot/vmlinuz-* | head -n1 | awk -F "->" '{print $2}' | grep -P -o "2.6.*" )
+
+fi
+
+if [ -z "${KSUFFIX}" ]; then
+ echo "Could not determine proper local kernel suffix!"
+ echo "This is needed to install kernel modules for graphics drivers!"
+ exit 1
+fi
+
+
+buildfglrx() {
+ # build ATI kernel module
+ cd ${BASE}/ati/usr/src/kernel-modules/fglrx
+ rm -rf fglrx.ko >/dev/null 2>&1
+ make KVER=${1} >/dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ cp fglrx.ko ../../../../modules
+ else
+ echo -e "Kernel module for kernel ${1} could not be built!"
+ fi
+ cd - >/dev/null 2>&1
+}
+
+
+##########################################################################
+# NVidia section
+##########################################################################
+if [ "$1" = "nvidia" ]; then
+ if [ -e nvidia/usr/lib/libGL.so.1 ]; then
+ exit
+ fi
+ if [ ! -d nvidia ]; then
+ mkdir -p nvidia/{modules,usr,temp}
+ fi
+ cd nvidia/temp
+
+ case ${DISTRO} in
+ suse-10.2*)
+ echo "* Running general NVidia installer (expected in xserver::pkgpath)"
+ # unpack the nvidia installer; quickhack - expects just one package
+ echo " * Unpacking installer"
+ sh ../../packages/NVIDIA-Linux-*.run -a -x >>nvidia-inst.log 2>&1
+ # prefix and paths should be matched more closely to each distro
+ # just demo at the moment ... but working at the moment
+ # without the kernel module
+ stdprfx=/opt/openslx/plugin-repo/xserver/nvidia
+
+ # backing up libglx.so and libGLcore.so
+ bkpprfx=${stdprfx}/../mesa/lib/xorg/modules/extensions
+ mkdir -p ${bkpprfx}
+ if [ -f /usr/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
+ cp /usr/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
+ elif [ -f /usr/X11R6/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/X11R6/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
+ cp /usr/X11R6/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
+ touch ${bkpprfx}/../../../../X11R6
+ fi
+ if [ -f /usr/lib/libGL.so.1.2 ]; then
+ cp /usr/lib/libGL.so.1.2 ${bkpprfx}/../../..
+ elif [ -f /usr/X11R6/lib/libGL.so.1.2 ]; then
+ cp /usr/X11R6/lib/libGL.so.1.2 ${bkpprfx}/../../..
+ touch ${bkpprfx}/../../../X11R6
+ fi
+
+
+ # run the lib installer
+ echo " * Starting the library installer"
+ echo "Starting the lib installer" >>nvidia-inst.log
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N --no-abi-note \
+ --x-prefix=${stdprfx}/usr --x-library-path=${stdprfx}/usr/lib \
+ --x-module-path=${stdprfx}/usr/lib/xorg/modules \
+ --opengl-prefix=${stdprfx}/usr --utility-prefix=${stdprfx}/usr \
+ --documentation-prefix=${stdprfx}/usr --no-runlevel-check \
+ --no-rpms --no-x-check --no-kernel-module \
+ --log-file-name=nvidia-lib.log >>nvidia-inst.log 2>&1
+ # how to get an idea of the installed kernel?
+ # run the kernel module creator (should be done for every kernel!?)
+ kernel=${KVERS}
+ echo " * Trying to compile a kernel module for $kernel"
+ echo "Starting the kernel module installer for $kernel" >>nvidia-inst.log
+ # we need the .config file in /usr/src/linux or where ever!
+ # we need scripts/genksyms/genksyms compiled via make scripts in /usr/src/linux
+ # option available in newer nvidia packages
+ cd /usr/src/linux-${kernel%-*}
+ # in suse we have the config file lying there
+ cp /boot/config-${kernel} .config
+ ARCH=$(cat .config| grep -o CONFIG_M.86=y |tail -n1|grep -o "[0-9]86")
+ SUFFIX=${kernel##*-}
+ cp -r /usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/ \
+ /usr/src/linux-${kernel%-*}
+ make scripts >/dev/null 2>&1
+ make prepare >/dev/null 2>&1
+ cd - >/dev/null 2>&1
+ #/usr/src/linux-${kernel%-*}
+ addopts="--no-cc-version-check"
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N -K --no-abi-note \
+ --kernel-source-path=/usr/src/linux-${kernel%-*} \
+ -k ${kernel} \
+ --kernel-install-path=/opt/openslx/plugin-repo/xserver/nvidia/modules \
+ --no-runlevel-check --no-abi-note --no-rpms ${addopts} \
+ --log-file-name=nvidia-kernel.log >>nvidia-inst.log 2>&1
+ if [ $? -gt 0 ];then
+ echo "* kernel module built failed!"
+ echo "* Have a look into the several log files in "
+ echo " stage1/${DISTRO}/plugin-repo/xserver"
+ fi
+
+
+ # redo some unwanted changes of nvidia-installer
+ if [ -f ${bkpprfx}/libglx.so ]; then
+ cp ${bkpprfx}/libGLcore.so /usr/lib/xorg/modules/extensions
+ cp ${bkpprfx}/libglx.so /usr/lib/xorg/modules/extensions
+ if [ -f ${bkpprfx}/X11R6 ]; then
+ cp ${bkpprfx}/libGLcore.so /usr/X11R6/lib/xorg/modules/extensions
+ cp ${bkpprfx}/libglx.so /usr/X11R6/lib/xorg/modules/extensions
+ fi
+ fi
+ if [ -f ${bkpprfx}/../../../libGL.so.1.2 ]; then
+ cp ${bkpprfx}/../../../libGL.so.1.2 /usr/lib
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ fi
+ ;;
+ suse-11.*)
+ echo "* Downloading nvidia rpm packages... this could take some time..."
+ # add repository for nvidia drivers
+ case ${DISTRO} in
+ suse-11.0*)
+ REPO=http://download.nvidia.com/opensuse/11.0/
+ ;;
+ suse-11.1*)
+ REPO=http://download.nvidia.com/opensuse/11.1/
+ ;;
+ esac
+ zypper --no-gpg-checks addrepo ${REPO} NVIDIA > /dev/null 2>&1
+ # get URLs by virtually installing nvidia-OpenGL driver
+ zypper --no-gpg-checks -n -vv install -D \
+ nvidia-gfxG01-kmp${KSUFFIX} > logfile 2>&1
+
+ # zypper refresh is requested if something is not found
+ if [ "1" -le "$(cat logfile | grep -o "zypper refresh"| wc -l)" ]; then
+ zypper --no-gpg-checks refresh >/dev/null 2>&1
+ fi
+
+ # take unique urls from logfile
+ URLS=$(cat logfile | grep -P -o "http://.*?rpm " | sort -u | xargs)
+ for RPM in $URLS; do
+ RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
+ if [ ! -e ${RNAME} ]; then
+ wget ${RPM} > /dev/null 2>&1
+ fi
+ # We use rpm2cpio from suse to extract
+ if [ -f ${RNAME} ]; then
+ rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
+ fi
+ done
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/
+ fi
+ if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
+ echo " NVIDIA files failed to install via zypper!!"
+ exit
+ fi
+
+ rm -rf ../usr
+ if [ -d ./usr ]; then
+ mv ./usr ..
+ fi
+ find lib/ -name "*.ko" -exec mv '{}' ../modules \; > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo " Could not find kernel module nvidia.ko!";
+ fi
+
+ cd ..
+ ;;
+ esac
+
+ rm -rf temp/
+ cd ..
+
+fi
+
+
+############################################################################
+# ATI section
+############################################################################
+if [ "$1" = "ati" ]; then
+ if [ -e ati/usr/lib/libGL.so.1.2 ]; then
+ exit
+ fi
+
+ mkdir -p ati/modules ati/temp
+
+ case ${DISTRO} in
+ suse-10.2*)
+ ### SUSE 10.2 section ###
+ echo "* Extracting ATI package (expected in xserver::pkgpath) ... this could take some time..."
+
+ PKG=`find packages/ -name ati-driver*\.run | tail -n1`
+ PKG_VERSION=`head ${PKG} | grep -P -o "[0-9]\.[0-9]{3}"`
+
+ chmod +x ${PKG}
+
+ ${PKG} --extract ati/temp >/dev/null 2>&1
+
+ cd ati/temp/
+ RPM=`./ati-installer.sh ${PKG_VERSION} --buildpkg SuSE/SUSE102-IA32 2>&1 | grep Package | awk '{print $2}' | tail -n1`
+
+ cd ..
+ rpm2cpio ${RPM} 2>/dev/null | cpio -id >/dev/null 2>&1
+
+
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/
+ fi
+ if [ -d etc ]; then
+ cp -r etc/* /etc/
+ fi
+
+ # cleanup
+ rm -rf ${RPM}
+ cd ..
+ rm -rf ${PKG}
+
+
+ buildfglrx ${KVERS}
+
+ ;;
+ suse-11.*)
+ ### SUSE 11.0 Section ###
+
+ echo "* Downloading ati rpm packages... this could take some time..."
+ cd ati/temp
+
+ # add repository for ATI drivers
+ case ${DISTRO} in
+ suse-11.0*)
+ zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.0/ ATI > /dev/null 2>&1
+ ;;
+ suse-11.1*)
+ zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.1/ ATI > /dev/null 2>&1
+ ;;
+ esac
+ # get URLs by virtually installing fglrx-OpenGL driver
+ zypper --no-gpg-checks -n -vv install -D ati-fglrxG01-kmp${KSUFFIX} \
+ x11-video-fglrxG01 > logfile 2>&1
+
+ # zypper refresh is requested if something is not found
+ if [ "1" -le "$(cat logfile | grep -o "zypper refresh" | wc -l)" ]; then
+ zypper --no-gpg-check refresh >/dev/null 2>&1
+ fi
+
+ # take unique urls from logfile
+ URLS=$(cat logfile | grep -P -o "http://.*?rpm " | grep fglrx | sort -u | xargs)
+ for RPM in $URLS; do
+ RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
+ if [ ! -e ${RNAME} ]; then
+ wget ${RPM} > /dev/null 2>&1
+ fi
+ # We use rpm2cpio from suse to extract -> propably new rpm version
+ if [ -f ${RNAME} ]; then
+ rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
+ fi
+ done
+
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/ > /dev/null 2>&1
+ fi
+ if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
+ echo " ATI files failed to install via zypper!!"
+ exit
+ fi
+
+ mv ./usr ..
+ mv ./etc ..
+
+ find lib/ -name "*.ko" -exec mv {} ../modules \; >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo " Could not find kernel module fglrx.ko!";
+ fi
+
+ ;;
+ esac
+ cd ..
+
+ # OpenGl implementation (libGL?) expect fglrx_dri.so in /usr/X11R6/lib/dri/
+ if [ ! -f /usr/X11R6/lib/modules/dri/fglrx_dri.so -a \
+ ! -f usr/X11R6/lib/modules/dri/fglrx_dri.so ]; then
+ if [ ! -d /usr/X11R6/lib/modules/dri ]; then
+ mkdir -p /usr/X11R6/lib/modules/dri
+ fi
+ if [ -f usr/lib/dri/fglrx_dri.so ]; then
+ ln -s ${BASE}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/X11R6/lib/modules/dri/fglrx_dri.so
+ fi
+ fi
+
+ rm -rf temp/
+fi
+
diff --git a/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh b/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh
new file mode 100755
index 00000000..c6ac17c9
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+# gets needed packages for ubuntu nvidia/ati drivers
+# $1 = nvidia | ati
+PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver"
+TMP_FOLDER="/tmp/slx-plugin/xserver"
+TARGET="$1"
+DISTRO="$2"
+
+if [ ! -d "${PLUGIN_FOLDER}" ]; then
+ mkdir -p "${PLUGIN_FOLDER}/modules"
+fi
+
+# change into temp
+cd ${TMP_FOLDER} > /dev/null
+
+if [ -e "/boot/vmlinuz" ]; then
+ KVER=$(ls -ahl '/boot/vmlinuz' | sed -e 's,^.*vmlinuz-,,g')
+else
+ KVER=$(find /lib/modules/2.6* -maxdepth 0|sed 's,/lib/modules/,,g'|sort|tail -n1)
+fi
+
+
+echo " * downloading restricted modules... this may take a while"
+# TODO: remove commented out "> /dev/null ..." later... multiple times
+# in this script! check all comments!
+aptitude download linux-restricted-modules-${KVER} #> /dev/null 2&>1
+if [ $? -eq 1 ]; then
+ echo " * Didn't get restricted modules. Exit now!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+fi
+MODULE_DEB=$(ls linux-restricted-modules-*.deb | tail -n1)
+dpkg-deb -x ${MODULE_DEB} ${TMP_FOLDER}/modules
+
+case ${TARGET} in
+ ati)
+ mkdir -p ${PLUGIN_FOLDER}/ati
+ mkdir -p ${PLUGIN_FOLDER}/ati/modules
+
+ echo " * downloading fglrx xorg package... this may take a while"
+ aptitude download xorg-driver-fglrx #> /dev/null 2&>1
+ if [ $? -eq 1 ]; then
+ echo " * Didn't get package xorg-driver-fglrx! Exit now!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+ fi
+ FGLRX_DEB=$(ls xorg-driver-fglrx_*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${FGLRX_DEB} ${PLUGIN_FOLDER}/ati
+
+ # assemble module
+ cd modules/lib/linux-restricted-modules/${KVER}/
+ ld_static -d -r -o ${PLUGIN_FOLDER}/ati/modules/fglrx.ko fglrx/*
+
+ if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ else
+ # remove link
+ rm -rf /usr/lib/dri/fglrx_dri.so
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/lib/dri/fglrx_dri.so
+
+ # Recent ATI drivers expect the driver link in /xyz
+ if [ ! -d /usr/X11R6/lib/modules/dri ]; then
+ mkdir -p /usr/X11R6/lib/modules/dri
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/X11R6/lib/modules/dri/fglrx_dri.so
+
+ # cleanup
+ cd ${PLUGIN_FOLDER}/ati
+
+ #@Volker: We need /etc-files - there is a database
+ # file for the fglrx-driver in stage3 !!!
+ #rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+
+ ;;
+
+
+ nvidia)
+ mkdir -p ${PLUGIN_FOLDER}/nvidia
+ mkdir -p ${PLUGIN_FOLDER}/nvidia/modules
+
+ echo " * downloading fglrx xorg package... this may take a while"
+ aptitude download nvidia-glx-new #> /dev/null 2&>1
+ if [ $? -eq 1 ]; then
+ echo " * Didn't get package nvidia-glx-new!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+ fi
+ #Bastian: what is this? please explain
+ #aptitude download nvidia-glx
+ NVIDIA_DEB=$(ls nvidia-glx*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${NVIDIA_DEB} ${PLUGIN_FOLDER}/nvidia
+
+ # assemble module - we just need the new one here
+ # TODO: modules for older graphics hardware can be found here
+ cd modules/lib/linux-restricted-modules/${KVER}/
+ ld_static -d -r -o ${PLUGIN_FOLDER}/nvidia/modules/nvidia.ko nvidia_new/*
+
+ #TODO: if we use this part, we need to copy the check from ati, too!
+ #if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ # mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ #else
+ # # remove link
+ # rm -rf /usr/lib/dri/fglrx_dri.so
+ #fi
+ #ln -s ${PLUGIN_FOLDER}/nvidia/nvroot/usr/lib/dri/nvidia_dri.so \
+ # /usr/lib/dri/fglrx_dri.so
+
+ # cleanup
+ cd ${PLUGIN_FOLDER}/nvidia
+ rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+ ;;
+esac
+
diff --git a/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh b/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh
new file mode 100755
index 00000000..259f2650
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh
@@ -0,0 +1,236 @@
+#!/bin/sh
+
+# gets needed packages for ubuntu nvidia/ati drivers
+# $1 = nvidia | ati
+PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver"
+TMP_FOLDER="/tmp/slx-plugin/xserver"
+TARGET="$1"
+
+if [ ! -d "${PLUGIN_FOLDER}" ]; then
+ mkdir -p "${PLUGIN_FOLDER}/modules"
+fi
+
+# change into temp
+cd ${TMP_FOLDER} > /dev/null
+
+if [ -e "/boot/vmlinuz" ]; then
+ KVER=$(ls -ahl '/boot/vmlinuz' | sed -e 's,^.*vmlinuz-,,g')
+else
+ KVER=$(find /lib/modules/2.6* -maxdepth 0|sed 's,/lib/modules/,,g'|sort|tail -n1)
+fi
+
+# TODO: check for build-essential !!
+
+if [ ! -e "/usr/sbin/dkms" ]; then
+ echo -n " * DKMS not found: installing .."
+ aptitude -y install dkms > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package dkms! Exit now!"
+ exit 1
+ else
+ echo "ok"
+ fi
+fi
+
+# TODO: find a more clean way for this workaround
+# the current dkms script included in ubuntu is trying to compile
+# kernel modules under the user nobody using "su" which is not
+# working in the installation phase of the plugin.
+
+if [ $(grep -c "getent passwd nobody" /usr/sbin/dkms) -ne 0 ]; then
+ echo -n " * Patch DKMS not to run under user nobody .."
+ sed -i "s/getent passwd nobody/getent passwd N0/" \
+ /usr/sbin/dkms
+ echo "ok"
+fi
+
+case ${TARGET} in
+ ati)
+ mkdir -p ${PLUGIN_FOLDER}/ati/modules
+
+ echo -n " * downloading fglrx xorg package... "
+ aptitude download xorg-driver-fglrx > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package xorg-driver-fglrx! Exit now!"
+ exit 1
+ else
+ echo "ok"
+ fi
+ FGLRX_DEB=$(ls xorg-driver-fglrx_*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${FGLRX_DEB} ${PLUGIN_FOLDER}/ati
+
+ echo -n " * downloading fglrx kernel package... "
+ aptitude download fglrx-kernel-source >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package fglrx-kernel-source!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ FGLRX_KERNEL_DEB=$(ls fglrx-kernel-source*.deb | tail -n1)
+ dpkg-deb -x ${FGLRX_KERNEL_DEB} /
+
+ FGLRX_SOURCE_DIR=$(find /usr/src/fglrx-${FGLRX_DRIVER_VERSION}* \
+ -maxdepth 0 -type d)
+ FGLRX_FULL_VERSION=$(echo ${FGLRX_SOURCE_DIR} | \
+ sed -e 's/\/usr\/src\/fglrx-//')
+
+ FGLRX_DKMS_DIR="/var/lib/dkms/fglrx/${FGLRX_FULL_VERSION}"
+
+ if [ -d /var/lib/dkms/fglrx/${FGLRX_FULL_VERSION} ]; then
+ if [ ! -L ${FGLRX_DKMS_DIR}/source ]; then
+ ln -sf ${FGLRX_SOURCE_DIR} ${FGLRX_DKMS_DIR}/source
+ fi
+ else
+ echo -n " * Add fglrx kernel module to dkms tree... "
+ dkms add -m fglrx -v ${FGLRX_FULL_VERSION} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ echo "fail"
+ exit 1
+ fi
+ fi
+
+ ###### build kernel module ######
+ echo -n " * Building fglrx kernel module for kernel ${KVER}... "
+ dkms -m fglrx -v ${FGLRX_FULL_VERSION} \
+ -k ${KVER} \
+ --kernelsourcedir /usr/src/linux-headers-${KVER}/ \
+ --no-prepare-kernel \
+ --no-clean-kernel \
+ build \
+ > /tmp/dkms.log 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ if $(cat /tmp/dkms.log | grep -q "has already"); then
+ echo "--- 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 \
+ | tail -n1 )
+
+ cp ${FGLRX_MODULE_PATH} ${PLUGIN_FOLDER}/ati/modules/fglrx.ko
+
+ # cleanup
+ if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ else
+ # remove link
+ rm -rf /usr/lib/dri/fglrx_dri.so
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/lib/dri/fglrx_dri.so
+
+ # cleanup
+ rm /tmp/dkms.log
+ cd ${PLUGIN_FOLDER}/ati
+
+ ;;
+
+
+ nvidia)
+ mkdir -p ${PLUGIN_FOLDER}/nvidia/modules
+
+ NVIDIA_DRIVER_VERSION=173
+
+ echo -n " * downloading nvidia xorg package... "
+ aptitude download nvidia-glx-${NVIDIA_DRIVER_VERSION} > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package nvidia-glx-${NVIDIA_DRIVER_VERSION}!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ echo -n " * downloading nvidia kernel package... "
+ aptitude download nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ NVIDIA_DEB=$(ls -1 nvidia-glx*.deb | tail -n1)
+ NVIDIA_KERNEL_DEB=$(ls -1 nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${NVIDIA_DEB} ${PLUGIN_FOLDER}/nvidia
+ # extract the sources deb to root
+ dpkg-deb -x ${NVIDIA_KERNEL_DEB} /
+
+ NVIDIA_SOURCE_DIR=$(find /usr/src/nvidia-${NVIDIA_DRIVER_VERSION}* \
+ -maxdepth 0 -type d)
+ NVIDIA_FULL_VERSION=$(echo ${NVIDIA_SOURCE_DIR} | \
+ sed -e 's/\/usr\/src\/nvidia-//')
+
+ NVIDIA_DKMS_DIR="/var/lib/dkms/nvidia/${NVIDIA_FULL_VERSION}"
+
+ if [ -d /var/lib/dkms/nvidia/${NVIDIA_FULL_VERSION} ]; then
+ if [ ! -L ${NVIDIA_DKMS_DIR}/source ]; then
+ ln -sf ${NVIDIA_SOURCE_DIR} ${NVIDIA_DKMS_DIR}/source
+ fi
+ else
+ echo -n " * Add nvidia kernel module to dkms tree... "
+ dkms add -m nvidia -v ${NVIDIA_FULL_VERSION} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ echo "fail"
+ exit 1
+ fi
+ fi
+
+ ###### build kernel module ######
+ echo -n " * Building nvidia kernel module for kernel ${KVER}... "
+ dkms -m nvidia -v ${NVIDIA_FULL_VERSION} \
+ -k ${KVER} \
+ --kernelsourcedir /usr/src/linux-headers-${KVER}/ \
+ --no-prepare-kernel \
+ --no-clean-kernel \
+ build \
+ > /tmp/dkms.log 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ if $(cat /tmp/dkms.log | grep -q "has already"); then
+ echo "--- 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 \
+ nvidia.ko | tail -n 1)
+
+ cp ${NVIDIA_MODULE_PATH} ${PLUGIN_FOLDER}/nvidia/modules/nvidia.ko
+
+ # cleanup
+ rm /tmp/dkms.log
+ cd ${PLUGIN_FOLDER}/nvidia
+ rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+ ;;
+esac
+
diff --git a/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh b/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
new file mode 100644
index 00000000..0b08ec13
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
@@ -0,0 +1,53 @@
+# Copyright (c) 2008 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'xserver' plugin - the runlevel script setting up the Xorg
+# configuration and checking for 3D capabilities and non-gpl drivers
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# get an idea of the installed graphics hardware - might be needed if the
+# automatic Xorg configation fails in this field. If no useable info was
+# detected just delete the file.
+
+# tablet detection function
+tabletdetect () {
+ sleep 1; waitfor /etc/hwinfo.bios 20000
+ # quickhack for IBM X61/ACER tablet detection (some kind of positive list
+ # or external admin configurable file needed)
+ if grep -qiE "tablet|TravelMate C200" /etc/hwinfo.bios ; then
+ echo 'wacomdev="ttyS0"' >/etc/tablet.conf
+ fi
+ # wacom device attached to usb - code to be tested
+ if [ ! -e /etc/tablet.conf ]; then
+ if hwinfo --usb | grep -qiE "wacom|tablet" ; then
+ echo 'wacomdev="input/wacom"' >/etc/tablet.conf
+ fi
+ fi
+}
+
+# hardware detection not really needed for Xorg => 1.7 used in newer versions
+# distro distinguishing here not 100% conform to the OpenSLX ideas. Hardware
+# detection might be needed for proprietary Xorg drivers ...
+# (clean up expected with rewritten stage3)
+case ${slxconf_distro_ver} in
+ "10.04"|"11.3")
+ ;;
+ *)
+ # hwinfo --gfxcard moved to general hardware detection as needed for two
+ # different plugins (bootsplash, xserver)
+ #( hwinfo --gfxcard >/etc/hwinfo.gfxcard ) &
+ ( hwinfo --monitor >/etc/hwinfo.display; grep "Generic Monitor" \
+ /etc/hwinfo.display >/dev/null 2>&1 && rm /etc/hwinfo.display ) &
+ ;;
+esac
+( tabletdetect ) &