#!/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 to \"nvidia\" driver"
echo "------------------------------------------------------------------------"
echo

if [ "`id -u`" != "0" ]; then
 echo "error: You must be root to use this program!"
 exit 1
fi

echo -n "Patching /etc/X11/XF86Config ... "

TMP_FILE=$(/bin/mktemp /tmp/XF86Config.XXXXXX) || { echo "switch2nv: can not create temporary file" >& 2; exit 1; }
cp /etc/X11/XF86Config $TMP_FILE
sed -e s/\"nv\"/\"nvidia\"/g $TMP_FILE > /etc/X11/XF86Config
rm $TMP_FILE
echo "done"

