#!/bin/sh

# Update the NVIDIA kernel module
# 1. Build the kernel module rpm.
rpmbuild -bb --without driverp --target "$(uname -m)" --define "kernel $(uname -r)" ~/src/rpm/SPECS/nvidia-glx.spec

# 2. We aren't debugging this thing.
rm ~/src/rpm/RPMS/i686/nvidia-glx-debuginfo-*.rpm

# 3. Update the local yum repo
mv ~/src/rpm/RPMS/i686/kernel-module-nvidia-$(uname -r)*.rpm ~/local/repo
createrepo ~/local/repo

# 4. Install the new Nvidia kernel module with yum.
sudo yum -y install "kernel-module-nvidia-$(uname -r)*"

# Update the SPCA50X kernel module.
cd ~/src/spca5xx
make clean
make
sudo make install
