#!/bin/bash
#  switchlibGL
#
#  Copyright (c) 2011 elrepo.org
#	Authors: Marco Giunta <giunta AT sissa DOT it>
#		 Philip J Perry <phil@elrepo.org>
#
#  Hacked script to prevent the ATI switchlibGL script
#  overwriting distribution libraries.
#
#  Usage:
#  switchlibGL   amd|intel|query
#    amd:   returns exit value 0
#    intel: returns exit value 0
#    query: prints "amd" on the standard output.
#    must be root to execute this script

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

case "$1" in
  "amd" )
	exit 0
  ;;
  "intel" )
	exit 0
  ;;
  "query" )
	echo "amd"
  ;;

  * ) 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
