#!/bin/sh
# This script should be called from the nvidia-exec-restart script as part of the dkms-nvidia installation


#Check that script is running under root (this is really only to stop any normal user finding and trying to run this script manually....... yes someone out there will find it and try to run it!)
if [ "$UID" != "0" ]; then
        echo "This script must be run as root."
        exit 0
fi

init 3
sleep 2
## We need to stop arts here otherwise it fails on resarting X
artsshell -q terminate
sleep 1
## Remove the old nvidia kernel module
rmmod nvidia
sleep 1
## Insert the new nvidia module
modprobe nvidia
sleep 1
init 5

