| 1 |
#!/bin/bash |
| 2 |
# Copyright 1999-2004 Gentoo Technologies, Inc. |
| 3 |
# Distributed under the terms of the GNU General Public License, v2 or later |
| 4 |
# Author: Martin Schlemmer <azarah@gentoo.org> |
| 5 |
# $Header: /var/cvsroot/gentoo/src/livecd-tools/Attic/opengl-update-livecd,v 1.2 2005/01/11 12:06:36 wolf31o2 Exp $ |
| 6 |
|
| 7 |
source /etc/init.d/functions.sh |
| 8 |
|
| 9 |
if [ \`id -u\` -ne 0 ] |
| 10 |
then |
| 11 |
eerror "\${0}: must be root." |
| 12 |
exit 1 |
| 13 |
fi |
| 14 |
|
| 15 |
usage() { |
| 16 |
cat << FOO |
| 17 |
usage: opengl-update-livecd <GL implementation> |
| 18 |
|
| 19 |
note: |
| 20 |
This utility switch between OpenGL implementations. Currently there |
| 21 |
are three supported implementations, namely "xorg-x11", "nvidia", and |
| 22 |
"ati", the implementations for X.Org, and the NVidia and ATI drivers |
| 23 |
respectively. |
| 24 |
|
| 25 |
examples: |
| 26 |
opengl-update-livecd xorg-x11 |
| 27 |
This will setup things to use libGL.so from X.Org |
| 28 |
|
| 29 |
opengl-update-livecd nvidia |
| 30 |
This will setup things to use libGL.so from the NVidia drivers. |
| 31 |
|
| 32 |
opengl-update-livecd ati |
| 33 |
This will setup things to use libGL.so from the ATI drivers. |
| 34 |
|
| 35 |
FOO |
| 36 |
exit 1 |
| 37 |
} |
| 38 |
|
| 39 |
if [ \$# -ne 1 ] |
| 40 |
then |
| 41 |
usage |
| 42 |
fi |
| 43 |
if [ ! -d /usr/lib/opengl/\${1} ] |
| 44 |
then |
| 45 |
usage |
| 46 |
else |
| 47 |
ebegin "Switching to \${1} OpenGL interface" |
| 48 |
|
| 49 |
#set up the \$LDPATH |
| 50 |
echo "LDPATH=/usr/lib/opengl/\${1}/lib" >/etc/env.d/09opengl |
| 51 |
/usr/sbin/env-update &>/dev/null |
| 52 |
|
| 53 |
#setup the /usr/lib/libGL.so symlink |
| 54 |
rm -f /etc/opengl/libGL.so /etc/opengl/libGL.so.1 |
| 55 |
|
| 56 |
realname="\$(readlink /usr/lib/opengl/\${1}/lib/libGL.so)" |
| 57 |
ln -sf /usr/lib/opengl/\${1}/lib/\${realname} \ |
| 58 |
/etc/opengl/libGL.so |
| 59 |
ln -sf /usr/lib/opengl/\${1}/lib/\${realname} \ |
| 60 |
/etc/opengl/libGL.so.1 |
| 61 |
|
| 62 |
#setup the /usr/X11R6/lib/libMesaGL.so symlink |
| 63 |
rm -f /etc/opengl/libMesaGL.so |
| 64 |
ln -sf /usr/lib/opengl/\${1}/lib/\${realname} \ |
| 65 |
/etc/opengl/libMesaGL.so |
| 66 |
|
| 67 |
rm -f /etc/opengl/libGLcore.so* |
| 68 |
|
| 69 |
if [ -e /usr/lib/opengl/\${1}/lib/libGLcore.so ] |
| 70 |
then |
| 71 |
realname="\$(readlink /usr/lib/opengl/\${1}/lib/libGLcore.so)" |
| 72 |
ln -sf /usr/lib/opengl/\${1}/lib/\${realname} \ |
| 73 |
/etc/opengl/libGLcore.so |
| 74 |
ln -sf /usr/lib/opengl/\${1}/lib/\${realname} \ |
| 75 |
/etc/opengl/libGLcore.so.1 |
| 76 |
fi |
| 77 |
|
| 78 |
#setup the /usr/X11R6/lib/modules/extensions/libglx.so symlink |
| 79 |
rm -f /etc/opengl/libglx.* |
| 80 |
|
| 81 |
if [ -e /usr/lib/opengl/\${1}/extensions/libglx.so ] |
| 82 |
then |
| 83 |
ln -sf /usr/lib/opengl/\${1}/extensions/libglx.so \ |
| 84 |
/etc/opengl/libglx.so |
| 85 |
fi |
| 86 |
#setup the /usr/X11R6/lib/modules/extensions/libglx.a symlink |
| 87 |
if [ -e /usr/lib/opengl/\${1}/extensions/libglx.a ] |
| 88 |
then |
| 89 |
ln -sf /usr/lib/opengl/\${1}/extensions/libglx.a \ |
| 90 |
/etc/opengl/libglx.a |
| 91 |
fi |
| 92 |
|
| 93 |
eend 0 |
| 94 |
fi |
| 95 |
|
| 96 |
|
| 97 |
# vim:ts=4 |