diff options
author | Kacper Kowalik (Xarthisius) <xarthisius.kk@gmail.com> | 2011-12-25 19:39:09 +0100 |
---|---|---|
committer | Kacper Kowalik (Xarthisius) <xarthisius.kk@gmail.com> | 2011-12-25 19:39:09 +0100 |
commit | fcb3008a52426533ad68729bddf821f194588fa4 (patch) | |
tree | a3b1c06bf67816855634de3392d5eecd09cbe0cb /x11-drivers/ati-drivers/files/switchlibGL | |
parent | fork nvidia-drivers (diff) | |
download | xarthisius-fcb3008a52426533ad68729bddf821f194588fa4.tar.gz xarthisius-fcb3008a52426533ad68729bddf821f194588fa4.tar.bz2 xarthisius-fcb3008a52426533ad68729bddf821f194588fa4.zip |
[x11-drivers/ati-drivers] import from x11 overlay
Diffstat (limited to 'x11-drivers/ati-drivers/files/switchlibGL')
-rw-r--r-- | x11-drivers/ati-drivers/files/switchlibGL | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/x11-drivers/ati-drivers/files/switchlibGL b/x11-drivers/ati-drivers/files/switchlibGL new file mode 100644 index 0000000..a6aa4fc --- /dev/null +++ b/x11-drivers/ati-drivers/files/switchlibGL @@ -0,0 +1,61 @@ +#!/bin/bash +# switchlibGL +# +# Copyright (c) 2011 Advanced Micro Devices, Inc. +# +# Purpose: +# For switch between AMD and Intel graphic driver library. +# +# Usage: +# switchlibGL amd|intel|query +# amd: switches to the AMD version of libGL. +# intel: switches to the open-source version of libGL . +# query: checks, which version is currently active and prints either "amd" +# or "intel" or "unknown" on the standard output. +# must be root to execute this script + +ARCH=`uname -m` +E_ERR=1 + +# Check if root +if [ "`whoami`" != "root" ]; then + echo "Must be root to run this script." 1>&2 + exit $E_ERR +fi + +# One parameter +if [ $# -ne 1 ]; then + echo "Usage: `basename $0` amd|intel|query " 1>&2 + echo "Please choose one parameter " 1>&2 + exit $E_ERR +fi + +current=$(eselect opengl show) +# Switch to right mode +case "$1" in + "amd" ) + if [ $current != ati ] ; then + eselect opengl set ati || return 1 + fi + ;; + "intel" ) + if [ $current != xorg-x11 ] ; then + eselect opengl set xorg-x11 || return 1 + fi + ;; + "query" ) + case "$current" in + "ati" ) + echo "amd" + ;; + "xorg-x11" ) + echo "intel" + ;; + esac + ;; + * ) echo "Usage: `basename $0` amd|intel|query" 1>&2; exit $E_ERR;; + # other than amd|intel|query parameter report an error +esac + +# A zero return value from the script upon exit indicates success. +exit 0 |