x11-tools/switch2nvidia

41 lines
1.5 KiB
Bash

#!/bin/sh
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Stefan Dirsch, 2001
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 675 Mass Ave, Cambridge MA 02139, USA.
echo "------------------------------------------------------------------------"
echo "Switching the use of \"nv\" driver of X.Org to \"nvidia\" driver of NVIDIA"
echo "------------------------------------------------------------------------"
echo
if [ "`id -u`" != "0" ]; then
echo "error: You must be root to use this program!"
exit 1
fi
head -n 2 /etc/X11/xorg.conf | tail -n 1 | grep "^# SaX"
if [ $? -eq 0 ]; then
echo -n "Patching /etc/X11/xorg.conf ... "
sed -e '/[ \t]*Driver[ \t]*"nv"/s/nv/nvidia/g' \
-e 's/[ \t]*Option[ \t]*"HWCursor"[ \t]*"off"/ Option "HWCursor" "on"/g' \
-e 's/[ \t]*Option[ \t]*"Composite"[ \t]*"off"/ Option "Composite" "on"/g' \
-i /etc/X11/xorg.conf
echo "done"
else
echo "SaX2 generated xorg.conf not available!"
fi