core/catalyst/switchlibglx

59 lines
1.4 KiB
Bash

#!/bin/bash
# switchlibGL and switchlibglx
#
# 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
# Switch to right mode
case "$1" in
"amd" )
eselect opengl set ati
;;
"intel" )
eselect opengl set xorg-x11
;;
"query" )
current=`eselect opengl show`
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