summarylogtreecommitdiffstats
path: root/switchlibglx
diff options
context:
space:
mode:
authorVi0L02015-06-08 20:32:00 +0200
committerVi0L02015-06-08 20:32:00 +0200
commit3c8ee5807f3f72f9fa6bf9610651a09c328890e9 (patch)
tree9d0875510d00501ad22d2b44eca25268bc89ff5f /switchlibglx
downloadaur-3c8ee5807f3f72f9fa6bf9610651a09c328890e9.tar.gz
Initial import
Diffstat (limited to 'switchlibglx')
-rwxr-xr-xswitchlibglx90
1 files changed, 90 insertions, 0 deletions
diff --git a/switchlibglx b/switchlibglx
new file mode 100755
index 00000000000..36b641923dd
--- /dev/null
+++ b/switchlibglx
@@ -0,0 +1,90 @@
+#!/bin/sh
+#
+# Vi0L0: i modified it a bit, version 2.1
+#
+# Copyright (c) 2010-2011 Sebastian Siebert (freespacer@gmx.de)
+# All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+# Set local language always to C
+export LC_ALL=C
+export LANG=C
+
+if [ "$(whoami)" != "root" ]; then
+ echo "Must be root to run this script." 1>&2
+ exit 1
+fi
+
+if [ $# -ge 2 ]; then
+ echo "Usage: $(basename $0) <amd|intel|query>" 1>&2
+ echo "Please choose one parameter" 1>&2
+ exit 1
+fi
+
+
+function switch_to_amd() {
+
+ ln -snf /usr/lib/xorg/modules/extensions/fglrx/fglrx-libglx.so \
+ /usr/lib/xorg/modules/extensions/libglx.so
+
+}
+
+function switch_to_intel() {
+
+ ln -snf /usr/lib/xorg/modules/extensions/libglx.xorg \
+ /usr/lib/xorg/modules/extensions/libglx.so
+
+}
+
+function get_current_driver() {
+
+ LIB_LINK="`readlink /usr/lib/xorg/modules/extensions/libglx.so 2>/dev/null`"
+ if [[ "${LIB_LINK}" = "/usr/lib/xorg/modules/extensions/fglrx/fglrx-libglx.so" || "${LIB_LINK}" = "fglrx/fglrx-libglx.so" ]]; then
+ echo "amd"
+ elif [ "${LIB_LINK}" = "/usr/lib/xorg/modules/extensions/libglx.xorg" ]; then
+ echo "intel"
+ else
+ echo "unknown"
+ fi
+
+}
+
+case "$1" in
+ amd)
+ echo "Switch to AMD" 1>&2
+ switch_to_amd
+ ;;
+ intel)
+ echo "Switch to Intel" 1>&2
+ switch_to_intel
+ ;;
+ query)
+ get_current_driver
+ ;;
+ *)
+ echo "Usage: $(basename $0) <amd|intel|query>" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0