#!/bin/sh

amd_target="/etc/ld.so.conf.d/GL/ati.conf"
intel_target="/etc/fglrx/pxpress-free.ld.so.conf"

case $1 in
amd)
	update-alternatives --set gl_conf "$amd_target" >/dev/null
	ldconfig -X
	;;
intel)
	update-alternatives --set gl_conf "$intel_target" >/dev/null
	ldconfig -X
	;;
query)
	case $(readlink -f "/etc/ld.so.conf.d/GL.conf") in
	$amd_target)
		echo "amd"
		;;
	$intel_target)
		echo "intel"
		;;
	*)
		echo "unknown"
		;;
	esac
	;;
esac
