#!/bin/bash

#nvidia-installation.sh v1.15
#1.0 Created for F14
#1.15 Edited for F15
#written by Andrew Schott
echo Installing nVIDIA files
yum -y install akmod-nvidia xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686 

echo Installing Bootconf to fix Plymouth
yum -y install bootconf-gui

#Until further notice, the selinux fix is broken (at least was on my systems).  Advising disabling selinux until further notice.
#echo Fixing selinux to work with the nVIDIA module
#grep gnome-session-c /var/log/audit/audit.log | audit2allow -M nvidiaisbroken
#semodule -i nvidiaisbroken.pp

echo Blacklist Nouveau
sed -i '/root=/s|$| rdblacklist=nouveau nouveau.modeset=0|' /boot/grub/grub.conf
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname   -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)

#This section is for eradication of Nouveau completely from system.  This is a last resort if the blacklisting fails.
#yum erase xorg-x11-drv-nouveau
#mv  /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nouveau/nouveau.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nouveau/nouveau.txt
#mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname  -r)-nouveau.img
#dracut /boot/initramfs-$(uname -r).img $(uname -r)

