blob: a6aa4fceb96b84391cb2477fb469a613d91c5abb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
|