diff options
author | Michael Janczyk | 2010-08-08 20:25:28 +0200 |
---|---|---|
committer | Michael Janczyk | 2010-08-08 20:25:28 +0200 |
commit | 85b13993176b36f0e5a6e4d3fbffbee956b68f3a (patch) | |
tree | e486a4b20ffb34e72debfbfb3284eede30713d75 /os-plugins | |
parent | Merge branch 'master' into vmgrid (diff) | |
parent | Minor optimizations ... (diff) | |
download | core-85b13993176b36f0e5a6e4d3fbffbee956b68f3a.tar.gz core-85b13993176b36f0e5a6e4d3fbffbee956b68f3a.tar.xz core-85b13993176b36f0e5a6e4d3fbffbee956b68f3a.zip |
Merge branch 'master' into vmgrid
Diffstat (limited to 'os-plugins')
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm | 5 | ||||
-rw-r--r-- | os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm | 101 | ||||
-rw-r--r-- | os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh | 38 | ||||
-rw-r--r-- | os-plugins/plugins/sysrqshutdown/files/shutdown | 54 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm | 26 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm | 319 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10_2.pm | 2 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm | 360 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm | 361 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm | 17 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/XX_xserver.sh | 201 | ||||
-rw-r--r-- | os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh | 23 |
12 files changed, 1071 insertions, 436 deletions
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm index 86ae59f9..433ed7e1 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm @@ -144,7 +144,10 @@ sub _setupCommonDmScript sed 's,^#!.*,,' /mnt/etc/X11/xdm/Xreset \ > /mnt/etc/X11/xdm/Xreset.system echo -e '#!/bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n - # remove safely any remaining files of the leaving user in /tmp + # avoid annoying messages on removed sound devices + ( su -c "rm ~/.kde4/share/config/phonondevicesrc" - $USER ) & + + # remove safely any remaining files of the leaving user in /tmp ( su -c "rm -rf /tmp/*" - $USER echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null chmod 0400 /tmp/files.removed ) & diff --git a/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm b/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm new file mode 100644 index 00000000..9800c203 --- /dev/null +++ b/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm @@ -0,0 +1,101 @@ +# Copyright (c) 2007 - 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/ +# ----------------------------------------------------------------------------- +# sysrqshutdown.pm +# - implementation of the 'sysrqshutdow' plugin, which replaces the shutdown +# binary through a SYSRQ shutdown script +# ----------------------------------------------------------------------------- +package OpenSLX::OSPlugin::sysrqshutdown; + +use strict; +use warnings; + +use base qw(OpenSLX::OSPlugin::Base); + +use File::Path; + +use OpenSLX::Basics; +use OpenSLX::Utils; + +sub new +{ + my $class = shift; + + my $self = { + name => 'sysrqshutdown', + }; + + return bless $self, $class; +} + +sub getInfo +{ + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + Replaces the shutdown binary through a SYSRQ shutdown script + End-of-Here + precedence => 10, + }; +} + +sub getAttrInfo +{ + my $self = shift; + + return { + 'sysrqshutdown::active' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'sysrqshutdown'-plugin be activated? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + + }; +} + +sub installationPhase +{ + my $self = shift; + my $info = shift; + + if (! -e "/sbin/shutdown.slxorig") { + # copy files + my $openslxBasePath = $info->{'openslx-base-path'}; + my $pluginName = $self->{'name'}; + my $pluginBasePath + = "$openslxBasePath/lib/plugins/$pluginName/files"; + + system("mv /sbin/shutdown /sbin/shutdown.slxorig"); + system("cp -p $pluginBasePath/shutdown /sbin/"); + chmod 0755, "/sbin/shutdown"; + } + + return; +} + +sub removalPhase +{ + my $self = shift; + my $info = shift; + + if (-e "/sbin/shutdown.slxorig") { + system("mv /sbin/shutdown.slxorig /sbin/shutdown"); + } + + return; +} + +1; diff --git a/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh b/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh new file mode 100644 index 00000000..66a728da --- /dev/null +++ b/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh @@ -0,0 +1,38 @@ +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 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 +# +# script is included from init via the "." load function - thus it has all +# variables and functions available + +# include default directories +. /etc/openslx.conf + +CONFFILE="/initramfs/plugin-conf/sysrqshutdown.conf" +PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/sysrqshutdown + +if [ -f $CONFFILE ]; then + + # load needed variables + . $CONFFILE + + if [ ${sysrqshutdown_active} -ne 0 ] ; then + [ ${DEBUGLEVEL} -gt 0 ] && echo "executing the 'sysrqshutdown' plugin ..." + + testmkd ${PLUGINCONFDIR} + cp $CONFFILE ${PLUGINCONFDIR}/sysrqshutdown.conf + + # finished ... + [ $DEBUGLEVEL -gt 0 ] && echo "done with 'sysrqshutdown' plugin ..." + fi +else + [ $DEBUGLEVEL -gt 0 ] && echo " * config of 'sysrqshutdown' plugin failed" +fi + diff --git a/os-plugins/plugins/sysrqshutdown/files/shutdown b/os-plugins/plugins/sysrqshutdown/files/shutdown new file mode 100644 index 00000000..7f4e9a1f --- /dev/null +++ b/os-plugins/plugins/sysrqshutdown/files/shutdown @@ -0,0 +1,54 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Copyright (c) 2010 - RZ Uni FR +# 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/ +# ----------------------------------------------------------------------------- +# shutdown +# - Script for SYSRQ shutdown +################################################################################ + +. /etc/opt/openslx/openslx.conf + +################################################################################ +### Define default dirs / get configs +################################################################################ + +PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins +PLUGINCONFVMGRID=${PLUGINCONFROOT}/sysrqshutdown +# include general configuration from vmgrid +if [ -f ${PLUGINCONFVMGRID}/sysrqshutdown.conf ]; then + . ${PLUGINCONFVMGRID}/sysrqshutdown.conf +else + sysrqshutdown_active=0 +fi + +if [ ${sysrqshutdown_active} -eq 1 ]; then + # check if reboot or halt + case "$@" in + '-r now') + for i in $(echo s u b); do + echo $i > /proc/sysrq-trigger & + done + exit 0 + ;; + '-h now') + for i in $(echo s u o); do + echo $i > /proc/sysrq-trigger & + done + exit 0 + ;; + esac +fi +# else use orig shutdown +shutdown.slxorig $@ + +exit 0 + diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm index b0fc67e3..51c1c60b 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm @@ -1,4 +1,4 @@ -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2008..2010 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -53,9 +53,29 @@ sub setupXserverScript my $pathInfo = $self->XserverPathInfo(); my $configFile = $pathInfo->{config}; - my $script = unshiftHereDoc(<<" End-of-Here"); + my $script = unshiftHereDoc(<<' End-of-Here'); # xserver.sh (base part) - # written by OpenSLX-plugin 'xserver', repoPath is $repoPath + # 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 diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm index 61372d54..55f42117 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm @@ -1,4 +1,4 @@ -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2008..2010 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -38,324 +38,21 @@ sub setupXserverScript 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 + # Xorg hardware is autodetected, so no module information provided + [ -z "${xmodule}" ] && \ + sed "/Section \"Device\"/,/EndSection/d" -i ${xfc} + testmkd /mnt/etc/X11/xorg.conf.d testmkd /mnt/var/lib/xkb/compiled - testmkd /mnt/var/X11R6/bin + testmkd /mnt/var/lib/X11 testmkd /mnt/var/lib/xdm/authdir/authfiles 0700 - ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X + ln -s /usr/bin/Xorg /mnt/var/lib/X11/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/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10_2.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10_2.pm index 18d8c029..f72ba877 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10_2.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10_2.pm @@ -8,7 +8,7 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# xserver/OpenSLX/Distro/Suse.pm +# xserver/OpenSLX/Distro/Suse_10_2.pm # - provides SUSE-specific overrides of the Distro API for the xserver # plugin. # ----------------------------------------------------------------------------- diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm new file mode 100644 index 00000000..4117c421 --- /dev/null +++ b/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/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm new file mode 100644 index 00000000..ab543549 --- /dev/null +++ b/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/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm index 728e6a03..057cf138 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm @@ -48,16 +48,21 @@ sub setupXserverScript my $script = $self->SUPER::setupXserverScript($repoPath); - $script .= unshiftHereDoc(<<' End-of-Here'); + # 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 - # newer Xorgs do not need predefined configuration file, not needed if - # XserverPathInfo gets implemented ... - sed -e "1i# xorg.conf not needed in most cases for Xorg 1.7+" \ - /mnt/etc/X11/xorg.conf >/etc/X11/xorg.openslx 2>/dev/null - rm /mnt/etc/X11/xorg.conf 2>/dev/null End-of-Here return $script; diff --git a/os-plugins/plugins/xserver/XX_xserver.sh b/os-plugins/plugins/xserver/XX_xserver.sh index fbdb832f..a2318c9f 100644 --- a/os-plugins/plugins/xserver/XX_xserver.sh +++ b/os-plugins/plugins/xserver/XX_xserver.sh @@ -1,5 +1,5 @@ # Copyright (c) 2008 - RZ Uni Freiburg -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2008..2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -15,6 +15,81 @@ # 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 "kbd" + 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 @@ -28,8 +103,6 @@ if [ -e /etc/slxsystem.conf ]; then . /etc/slxsystem.conf fi -# Xorg configuration file location -xfc="/mnt/etc/X11/xorg.conf" # directory for libGL, DRI library links to point to proper library set # depending on the hardware environment glliblinks="/mnt/var/X11R6/lib/" @@ -51,9 +124,9 @@ if [ -e /initramfs/plugin-conf/xserver.conf -a \ 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}" \ + 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 @@ -71,8 +144,7 @@ if [ -e /initramfs/plugin-conf/xserver.conf -a \ # begin proprietary drivers section (xorg.conf part) ###################################################################### - - if $(grep -iq -m 1 'Module: fglrx' /etc/hwinfo.gfxcard) && \ + 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 @@ -150,103 +222,25 @@ ${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\," # end proprietary drivers xorg.conf section ###################################################################### - - 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 - echo ' -Section "Files" -# ModulePath "/usr/lib/xorg/modules/,/usr/lib64/xorg/modules/" -EndSection -Section "ServerFlags" - Option "AllowMouseOpenFail" - Option "blank time" "5" - Option "standby time" "10" - Option "suspend time" "15" - Option "off time" "20" -EndSection -Section "Module" - Load "i2c" - Load "bitmap" - Load "ddc" - Load "extmod" - Load "freetype" - Load "int10" - Load "vbe" - Load "glx" - Load "dri" -EndSection -Section "InputDevice" - Identifier "Generic Keyboard" - Driver "kbd" - Option "CoreKeyboard" - Option "XkbRules" "xorg" - Option "XkbModel" "pc105" - Option "XkbLayout" "us" -EndSection -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 -Section "Device" - Identifier "Generic Video Card" - Driver "vesa" -# BusID "PCI:xx" #especially needed for fglrx -EndSection -Section "Monitor" - Identifier "Generic Display" - Option "DPMS" -# Modelname "could be enabled via xserver::ddcinfo attribute" -# Vertrefresh ... -# Horizsync ... -# DisplaySize ... -EndSection -Section "Screen" - Identifier "Default Screen" - Device "Generic Video Card" - Monitor "Generic Display" - DefaultDepth 24 -# SubSection "Display" -# Depth 24 -# Modes "1024x768" "800x600" -# EndSubSection -EndSection -Section "ServerLayout" - Identifier "Default Layout" - Screen "Default Screen" - InputDevice "Generic Keyboard" - InputDevice "Generic Mouse" -EndSection -Section "DRI" - Mode 0666 -EndSection' >> $xfc - # keyboard setup (fill XKEYBOARD) + # write the xorg.conf completely or in files needed (depending on + # distro version) + # determine keyboard setup (fill XKEYBOARD) localization "${country}" - # 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 + # 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 + -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\"/ { + dmesg | grep -q -E "ynaptics" ; then + sed -e '/\"CorePointer\"/ { a\ EndSection\ Section "InputDevice"\ @@ -256,13 +250,13 @@ Section "InputDevice"\ Option "SendCoreEvents" "true" }' -e '/Device "Generic Mouse"/ { a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents" -}' -i $xfc +}' -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 + -i ${xfc} fi ############################################ @@ -275,7 +269,7 @@ a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents" 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 + sed -i "s,\(Driver.*\"nvidia\"\),\1\n Option \"NoLogo\" \"True\"," ${xfc} fi fi @@ -337,19 +331,16 @@ EndSection' >> ${xfc} [ -n "$vert" -a -n "$horz" ] && \ sed -e "s|# Horizsync.*| Horizsync $horz|;\ s|# Vertrefre.*| Vertrefresh $vert|;\ - s|# Modelname.*| Modelname \"$modl\"|" -i $xfc + s|# Modelname.*| Modelname \"$modl\"|" -i ${xfc} [ -n "$size" ] && \ - sed -e "s|# DisplaySi.*| DisplaySize $size|" -i $xfc + 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 + s|# EndSubSection.*| EndSubSection|;" -i ${xfc} fi - # run distro specific generated stage3 script - [ -e /mnt/opt/openslx/plugin-repo/xserver/xserver.sh ] && \ - . /mnt/opt/openslx/plugin-repo/xserver/xserver.sh [ $DEBUGLEVEL -gt 0 ] && echo "done with 'xserver' os-plugin ..." diff --git a/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh b/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh index f9c3e7a7..3e50b77f 100644 --- a/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh +++ b/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh @@ -1,5 +1,5 @@ # Copyright (c) 2008 - RZ Uni Freiburg -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2008..2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -19,11 +19,6 @@ # automatic Xorg configation fails in this field. If no useable info was # detected just delete the file. -# not really needed for ubuntu 10.04 -# ToDo: fix so it is not installed by default -#echo ${slx_distro_name}${slx_distro_ver}>/tmp/utest -#[ ${slx_distro_name} = "ubuntu" ] && [ ${slx_distro_ver} = "10.04" ] && exit 0 - # tablet detection function tabletdetect () { sleep 1; waitfor /etc/hwinfo.bios 20000 @@ -40,7 +35,17 @@ tabletdetect () { fi } -( hwinfo --gfxcard >/etc/hwinfo.gfxcard ) & -( hwinfo --monitor >/etc/hwinfo.display; grep "Generic Monitor" \ - /etc/hwinfo.display >/dev/null 2>&1 && rm /etc/hwinfo.display ) & +# 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 >/etc/hwinfo.gfxcard ) & + ( hwinfo --monitor >/etc/hwinfo.display; grep "Generic Monitor" \ + /etc/hwinfo.display >/dev/null 2>&1 && rm /etc/hwinfo.display ) & + ;; +esac ( tabletdetect ) & |