From a52db341bc76a92882c0baa64956d22415b9ba57 Mon Sep 17 00:00:00 2001 From: Bastian Wissler Date: Wed, 18 Feb 2009 19:43:37 +0000 Subject: xserver plugin: * Corrected support for SuSE 11.0 (NVIDIA/ATI) * Added support for SuSE 11.1 (NVIDIA/ATI) git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2608 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../plugins/xserver/OpenSLX/OSPlugin/xserver.pm | 13 +- os-plugins/plugins/xserver/files/ati-install.sh | 11 +- os-plugins/plugins/xserver/files/nvidia-install.sh | 42 ++++--- .../plugins/xserver/files/suse-gfx-install.sh | 134 +++++++++++++-------- .../plugins/xserver/files/ubuntu-gfx-install.sh | 1 + 5 files changed, 119 insertions(+), 82 deletions(-) diff --git a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm index fc1d5124..e4c63736 100644 --- a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm +++ b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm @@ -227,22 +227,25 @@ sub installationPhase "$openslxBasePath/lib/plugins/$self->{'name'}/files"; my $installationPath = "$pluginRepoPath/"; my $binDrivers = 0; + my $engine = $self->{'os-plugin-engine'}; + - # TODO: handle it better. We know the distribution in stage1 if ($attrs->{'xserver::nvidia'} == 1 || $attrs->{'xserver::ati'} == 1 ) { copyFile("$pluginFilesPath/ubuntu-gfx-install.sh", "$installationPath"); copyFile("$pluginFilesPath/suse-gfx-install.sh", "$installationPath"); copyFile("$pluginFilesPath/ubuntu-8.10-gfx-install.sh", "$installationPath"); - #copyFile("$pluginFilesPath/linkage.sh", "$installationPath"); - # be on the safe side (BASH) - Ubuntu sets some crazy stupid 'dash' shell otherwise - #system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/linkage.sh clean"); - + # removeLinks is to remove Links to the files # otherwise some wrong files are created $self->removeLinks(); $binDrivers = 1; } if ($attrs->{'xserver::ati'} == 1) { + #TODO: if ($vendorOSName contains 'suse-11.1') + $engine->installPackages( + $engine->getInstallablePackagesForSelection('libstdc++33') + ); + copyFile("$pluginFilesPath/ati-install.sh", "$installationPath"); system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/ati-install.sh $vendorOSName"); #system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/linkage.sh ati"); diff --git a/os-plugins/plugins/xserver/files/ati-install.sh b/os-plugins/plugins/xserver/files/ati-install.sh index 7bbe48d1..22fde4a1 100755 --- a/os-plugins/plugins/xserver/files/ati-install.sh +++ b/os-plugins/plugins/xserver/files/ati-install.sh @@ -2,23 +2,18 @@ cd /opt/openslx/plugin-repo/xserver -# Ubuntu gfx-install.sh skript DISTRO=$1 case $DISTRO in ubuntu-8.10) - ./ubuntu-8.10-gfx-install.sh ati + ./ubuntu-8.10-gfx-install.sh ati ${DISTRO} ;; ubuntu-*) - ./ubuntu-gfx-install.sh ati + ./ubuntu-gfx-install.sh ati ${DISTRO} ;; -# End ubuntu gfx-install.sh - -# SUSE gfx-install.sh skript suse-*) - # we have SuSE - run ubuntu-gfx-install - ./suse-gfx-install.sh ati + ./suse-gfx-install.sh ati ${DISTRO} ;; esac diff --git a/os-plugins/plugins/xserver/files/nvidia-install.sh b/os-plugins/plugins/xserver/files/nvidia-install.sh index ded6395e..4a82e123 100755 --- a/os-plugins/plugins/xserver/files/nvidia-install.sh +++ b/os-plugins/plugins/xserver/files/nvidia-install.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ########################################################## # Installs NVIDIA binary drivers into openslx plugin-repo @@ -18,18 +18,18 @@ else fi - +#change to plugin path cd ${PLUGIN_PATH} case ${DISTRO} in ubuntu-8.10*) - ./ubuntu-8.10-gfx-install.sh nvidia + ./ubuntu-8.10-gfx-install.sh nvidia ${DISTRO} ;; ubuntu*) - ./ubuntu-gfx-install.sh nvidia + ./ubuntu-gfx-install.sh nvidia ${DISTRO} ;; - suse-11.0*) - ./suse-gfx-install.sh nvidia + suse-11.*) + ./suse-gfx-install.sh nvidia ${DISTRO} ;; # general purpose nvidia installer script *) @@ -79,24 +79,28 @@ case ${DISTRO} in # 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 - if [ ! -f /usr/src/linux-${kernel}/include/linux/kernel.h ]; then - cd /usr/src/linux-${kernel%-*} - if [ ! -f .config ]; then - if [ -f /boot/config-${kernel} ]; then - # in suse we have the config file lying there - cp /boot/config-${kernel} .config - fi - fi - make scripts >/dev/null 2>&1 - make prepare >/dev/null 2>&1 - cd - >/dev/null 2>&1 - fi + 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%-*} -k ${kernel} \ + --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" diff --git a/os-plugins/plugins/xserver/files/suse-gfx-install.sh b/os-plugins/plugins/xserver/files/suse-gfx-install.sh index 9a55f0b0..3a36a3dc 100755 --- a/os-plugins/plugins/xserver/files/suse-gfx-install.sh +++ b/os-plugins/plugins/xserver/files/suse-gfx-install.sh @@ -1,9 +1,16 @@ #!/bin/sh # -# Currently 11.0 is supported! -# -# Working on 10.2 with pgk-installer +# supported: +# nvidia: +# * 10.2 (pkg-installer) +# * 11.0 (zypper rpm packages) +# * not yet - soon - 11.1 +# +# ati: +# * 10.2 (pkg-installer) +# * 11.0 (zypper rpm packages) +# * 11.1 (zypper rpm packages) # # not right any more - removed from script @@ -11,6 +18,7 @@ #BUSYBOX="/mnt/opt/openslx//busybox/busybox" BASE=/opt/openslx/plugin-repo/xserver +DISTRO=$2 cd ${BASE} if [ -L /boot/vmlinuz ]; then @@ -33,17 +41,16 @@ fi buildfglrx() { - # build ATI kernel module + # build ATI kernel module cd ${BASE}/ati/usr/src/kernel-modules/fglrx - rm -rf fglrx.ko >/dev/null 2>&1 + 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 + 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 - } @@ -51,6 +58,10 @@ buildfglrx() { # NVidia section ########################################################################## if [ "$1" = "nvidia" ]; then + if [ ! -d nvidia ]; then + mkdir -p nvidia/{modules,usr,temp} + fi + cd nvidia/temp if [ -e nvidia/usr/lib/libGL.so.1 ]; then exit fi @@ -59,41 +70,53 @@ if [ "$1" = "nvidia" ]; then ## SUSE 11.0 Section ## ############################################################ - # distro info should be passed by calling scripts as known within the - # plugin environment, see e.g. rev2561 - if [ "11.0" = "`cat /etc/SuSE-release | tail -n1 | cut -d' ' -f3`" ]; then - echo " * Downloading nvidia rpm packages... this could take some time..." - # add repository for nvidia drivers - zypper --no-gpg-checks addrepo http://download.nvidia.com/opensuse/11.0/ NVIDIA > /dev/null 2>&1 - # get URLs by virtually installing nvidia-OpenGL driver - zypper --no-gpg-checks -n -vv install -D x11-video-nvidiaG01 > 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 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 + case ${DISTRO} in + suse-11.*) + echo "* Downloading nvidia rpm packages... this could take some time..." + # add repository for nvidia drivers + case ${DISTRO} in + suse-11.0*) + zypper --no-gpg-checks addrepo http://download.nvidia.com/opensuse/11.0/ NVIDIA > /dev/null 2>&1 + ;; + suse-11.1*) + zypper --no-gpg-checks addrepo http://download.nvidia.com/opensuse/11.1/ NVIDIA > /dev/null 2>&1 + ;; + esac + # 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 refresh >/dev/null 2>&1 fi - # We use rpm2cpio from suse to extract - rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1 - done - mv ./usr/X11R6/lib/* ./usr/lib/ - mv ./usr .. - find lib/ -name "*.ko" -exec mv {} ../modules \; + + # 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 + rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1 + done + mv ./usr/X11R6/lib/* ./usr/lib/ + + rm -rf ../usr + mv ./usr .. + find lib/ -name "*.ko" -exec mv '{}' ../modules \; + + cd .. + ;; + esac - fi + rm -rf temp/ + cd .. - cd .. fi - ############################################################################ # ATI section ############################################################################ @@ -104,7 +127,8 @@ if [ "$1" = "ati" ]; then mkdir -p ati/modules ati/temp - if [ "10.2" = "`cat /etc/SuSE-release | tail -n1 | awk '{print $3}'`" ]; then + case ${DISTRO} in + suse-10.2*) ### SUSE 10.2 section ### echo "* Extracting ATI package (expected in xserver::pkgpath) ... this could take some time..." @@ -119,7 +143,7 @@ if [ "$1" = "ati" ]; then 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 -i --make-directories >/dev/null 2>&1 + rpm2cpio ${RPM} 2>/dev/null | cpio -id >/dev/null 2>&1 mv ./usr/X11R6/lib/* ./usr/lib/ @@ -129,18 +153,24 @@ if [ "$1" = "ati" ]; then cd .. rm -rf ${PKG} - buildfglrx ${KVERS} - - fi + buildfglrx ${KVERS} - if [ "11.0" = "`cat /etc/SuSE-release | tail -n1 | awk '{print $3}'`" ]; then + ;; + suse-11.*) ### SUSE 11.0 Section ### echo "* Downloading ati rpm packages... this could take some time..." - cd ati/temp + cd ati/temp - # add repository for nvidia drivers + # 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 @@ -165,9 +195,13 @@ if [ "$1" = "ati" ]; then mv ./usr .. mv ./etc .. - find lib/ -name "*.ko" -exec mv {} ../modules \; + find lib/ -name "*.ko" -exec mv {} ../modules \; >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Could not find kernel module nvidia.ko!"; + fi - fi + ;; + esac cd .. rm -rf temp/ diff --git a/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh b/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh index 6d3345bc..078f6c69 100755 --- a/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh +++ b/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh @@ -5,6 +5,7 @@ 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" -- cgit v1.2.3-55-g7522