#!/bin/bash
#
# /sbin/xselect default|vesa|radeon
#
# This script selects which XF86Config file is used by linking
# XF86Config to either XF86Config.RADEON or XF86Config.VESA
#
# The radeon version is necessary for performance, and for
# running mplayer (dvd). The vesa driver is necessary for
# suspend/resume stability - and is the default
#
# This script may be run by the (super) user, followed by
# clt-alt-bs to select the other driver, or from rc.local
# at boot time. The boot time selection should probably
# be "default".
#
# If XF86Config is not already a link, this script will decline
# to do anything.
XFCPATH=/etc/X11/
XFCFILE=XF86Config
XFCDEF=VESA
if [ $UID != 0 ]
then
echo "$0 requires root privileges"
su root $0 $1
exit 0
fi
if ! [ -h /etc/X11/XF86Config ]
then
echo "$0: $XFCPATH$XFCFILE is not a link - aborting"
exit 1
fi
case $1 in
default)
echo "$0: linking $XFCFILE to $XFCFILE.$XFCDEF"
ln -s -f $XFCPATH$XFCFILE.$XFCDEF $XFCPATH$XFCFILE
;;
vesa)
echo "$0: linking $XFCFILE to $XFCFILE.VESA"
ln -s -f $XFCPATH$XFCFILE.VESA $XFCPATH$XFCFILE
;;
radeon)
echo "$0: linking $XFCFILE to $XFCFILE.RADEON"
ln -s -f $XFCPATH$XFCFILE.RADEON $XFCPATH$XFCFILE
;;
*)
echo "$0: unrecognized command!"
echo "usage $0 default|vesa|radeon"
exit 1
;;
esac
exit 0