diff options
| author | Bastian Wissler | 2008-09-05 21:30:17 +0200 |
|---|---|---|
| committer | Bastian Wissler | 2008-09-05 21:30:17 +0200 |
| commit | 2644709e29f5761c9753ea57b408d787914ba1d9 (patch) | |
| tree | bfabfda29f84982434c107a6f879611a9a0b5eb4 /os-plugins/plugins | |
| parent | removed setting of KDEHOME for SUSE, Debian and Gentoo. (diff) | |
| download | core-2644709e29f5761c9753ea57b408d787914ba1d9.tar.gz core-2644709e29f5761c9753ea57b408d787914ba1d9.tar.xz core-2644709e29f5761c9753ea57b408d787914ba1d9.zip | |
* linkage.sh is working (almost) - with libGL.so.1 not linked properly
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2210 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins')
| -rwxr-xr-x | os-plugins/plugins/xserver/files/linkage.sh | 144 |
1 files changed, 100 insertions, 44 deletions
diff --git a/os-plugins/plugins/xserver/files/linkage.sh b/os-plugins/plugins/xserver/files/linkage.sh index 4bdbfd80..3a312814 100755 --- a/os-plugins/plugins/xserver/files/linkage.sh +++ b/os-plugins/plugins/xserver/files/linkage.sh @@ -1,5 +1,4 @@ -#!/bin/bash - +#!/bin/bash --debugger # # @@ -8,22 +7,18 @@ # PLUGIN_PATH="/opt/openslx/plugin-repo/xserver/" -MESA_PATH="${PLUGIN_PATH}mesa/" # this has to be writable in stage3 -LINK_PATH="/var/lib/X11R6/lib/" +LINK_PATH="/var/X11R6/lib/" # these are to link libs to ATIROOT="${PLUGIN_PATH}ati" NVROOT="${PLUGIN_PATH}nvidia" -# declare array of conflicting libs -# TODO: add conflicting libs for opengl here -declare -a CONF_LIBS=("/usr/lib/libGL.so.1.2" "/usr/lib/libGL.so.1") - - -if [ ! -d "${MESA_PATH}usr/lib/" ]; then - mkdir -p "${MESA_PATH}usr/lib/" +# this is a backup folder for mesa files +MESAROOT="${PLUGIN_PATH}mesa/" +if [ ! -d "${MESAROOT}usr/lib/" ]; then + mkdir -p "${MESAROOT}usr/lib/" fi if [ ! -d "${LINK_PATH}" ]; then mkdir -p "${LINK_PATH}" @@ -37,39 +32,44 @@ fi - -function linkMesa { +########################################## +# saves a mesa file into MESAROOT +# and creates a link +########################################## +function linkMesa() { file=$1 + + # get path without /usr/lib/ l_path="${file/$(basename $file)/}" + l_path=${l_path/\/usr\/lib/} if [ ! -d "${LINK_PATH}${l_path}" ]; then mkdir -p ${LINK_PATH}${l_path} fi - if [ -f "/${file}" ]; then + + if [ -e "/${file}" ]; then + file=${file/\/usr\/lib/} # move file to the mesa implementation PATH - mv "${file}" "${MESA_PATH}${file}" + mv "/usr/lib/${file}" "${MESAROOT}${file}" >/dev/null 2&>1 # create links from link-PATH to mesa-PATH - ln -s "${MESA_PATH}${file}" "${LINK_PATH}${file}" + ln -s "${MESAROOT}${file}" "${LINK_PATH}${file}" # create links from sys-PATH to link-PATH - ln -s "${LINK_PATH}${file}" "${file}" - - else - # ${file} is a link here - rm -rf "${file}" - case ${file} in - /usr/lib/libGL.so.1) - ln -s "${LINK_PATH}${file}.2" "${LINK_PATH}${file}" - ;; - *) - ;; - esac + ln -s "${LINK_PATH}${file}" "/usr/lib/${file}" fi } + +######################################## +# this is the main installation +# +# ALL conflicting libs are detected +# and linked accordingly +# # saves a link of all conflicting # libraries into ${LINK_PATH} # and into system root -function divert { +######################################## +function divert() { # root PATH # as first argument @@ -77,32 +77,48 @@ function divert { # files to compare CMPROOT="$2" - # get files (withouth module-path - which we set in xorg.conf) - local -a LIB_ARRAY=($(find ${ROOT} -type f -wholename \ - ".*[^/xorg/modules/].*so.*"|xargs)) - # go through all libs and see if they are conflicting - for lib in ${LIB_ARRAY[@]}; do - # strip leading root and add comparing root + for lib in $(find ${ROOT} -wholename \ + "*/xorg/modules" -prune -a '!' -type d \ + -o -wholename '*so*'|xargs ); do + # strip leading ROOT cmplib="${lib#${ROOT}}" - if [ -e "${cmplib}" -a -e "${lib}" ]; then - # system conflicts with root - # - first we copy to MESA_PATH - # - and create a link to LINK_PATH + + + if [ -f "${cmplib}" -a -f "${lib}" ]; then + # system folder conflicts with ROOT linkMesa ${cmplib} continue fi - if [ -e "${lib}" -a -e "${CMPROOT}${cmplib}" ]; then + + # throwing away the basename + # leaving the folder + l_path="${cmplib/$(basename $lib)/}" + l_path=${l_path#/usr/lib} + + # here is the hairy thing + # if CMPROOT="", just link the lib + # if two libs conflicts, link to /var/X11R6/lib/ + + if [ -n "${CMPROOT}" -a -e "${lib}" -a -e "${CMPROOT}${cmplib}" ]; then # two roots are conflicting # create a link into LINK_PATH - l_path="${cmplib/$(basename $lib)/}" + if [ -h "${l_path}${cmplib}" ]; then + # it already exists + continue + fi if [ ! -d "${LINK_PATH}${l_path}" -o ! -d "${l_path}" ]; then mkdir -p ${LINK_PATH}${l_path} ${l_path} fi - touch ${LINK_PATH}${cmplib} + + # create link ladder (defaults to first called implementation) + ln -s ${ROOT}${cmplib} ${LINK_PATH}${cmplib} ln -s ${LINK_PATH}${cmplib} $cmplib else + + # just link library to root folder + # nothing conflicts here l_path="${cmplib/$(basename $lib)/}" if [ ! -d "${l_path}" ]; then mkdir -p ${l_path} @@ -114,8 +130,48 @@ function divert { -divert $NVROOT $ATIROOT -divert $ATIROOT $NVROOT +############################################### +# remove all links from system fs +# +# just run this function to clean up system +############################################### +function uninstDist() { + # put mesa implementation back to + mv ${MESAROOT}/usr/* /usr/lib/ + + # somehow we have to repair this + ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1 + + # delete all remaining links to /opt/openslx and /var/X11R6/lib + find /usr/lib -lname "${PLUGIN_PATH}*" \ + -o -lname "${LINK_PATH}*" |xargs rm -rf + # delete LINK_PATH + rm -rf ${LINK_PATH} # we could also delete ${MESAROOT} + +} + +if [ "$1" = "clean" ]; then + uninstDist + exit +fi + +if [ "$1" = "both" ]; then + divert $NVROOT $ATIROOT + divert $ATIROOT $NVROOT + exit +fi + +if [ "$1" = "nvidia" ]; then + divert ${NVROOT} + exit +fi + +if [ "$1" = "ati" ]; then + divert ${ATIROOT} + exit +fi + + |
