Magellan Linux

Annotation of /trunk/ati-drivers/switchlibGL

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1742 - (hide annotations) (download)
Thu Apr 19 09:43:31 2012 UTC (12 years ago) by niro
File size: 1341 byte(s)
-added scripts needed by >=12.3
1 niro 1742 #!/bin/bash
2     # switchlibGL
3     #
4     # Copyright (c) 2011 Advanced Micro Devices, Inc.
5     #
6     # Purpose:
7     # For switch between AMD and Intel graphic driver library.
8     #
9     # Usage:
10     # switchlibGL amd|intel|query
11     # amd: switches to the AMD version of libGL.
12     # intel: switches to the open-source version of libGL.
13     # query: checks, which version is currently active and prints either "amd"
14     # or "intel" or "unknown" on the standard output.
15     # must be root to execute this script
16    
17     ARCH=`uname -m`
18     E_ERR=1
19    
20     # Check if root
21     if [ "`whoami`" != "root" ]; then
22     echo "Must be root to run this script." 1>&2
23     exit $E_ERR
24     fi
25    
26     # One parameter
27     if [ $# -ne 1 ]; then
28     echo "Usage: `basename $0` amd|intel|query " 1>&2
29     echo "Please choose one parameter " 1>&2
30     exit $E_ERR
31     fi
32    
33     current=$(opengl-update --get-implementation)
34     # Switch to right mode
35     case "$1" in
36     "amd" )
37     if [ $current != ati ] ; then
38     opengl-update ati || return 1
39     fi
40     ;;
41     "intel" )
42     if [ $current != xorg ] ; then
43     opengl-update xorg || return 1
44     fi
45     ;;
46     "query" )
47     case "$current" in
48     "ati" )
49     echo "amd"
50     ;;
51     "xorg" )
52     echo "intel"
53     ;;
54     esac
55     ;;
56     * ) echo "Usage: `basename $0` amd|intel|query" 1>&2; exit $E_ERR;;
57     # other than amd|intel|query parameter report an error
58     esac
59    
60     # A zero return value from the script upon exit indicates success.
61     exit 0