#!/bin/sh

if test "$UID" = "0"; then
	# running as root anyway, don't need sudo
	INSMOD="/sbin/insmod"
	RMMOD="/sbin/rmmod"
else
	INSMOD="sudo /sbin/insmod"
	RMMOD="sudo /sbin/rmmod"
fi

# handy functions for rmmod/insmod
function xrmmod () {
	grep -qe "^$1 " /proc/modules || return
	echo rmmod $1
	$RMMOD $1 || exit 1
}
function xinsmod () {
	echo insmod $*
	$INSMOD -f $* || exit 1
}

# prepare for crashing the box -- flush dirty buffers
sync; sleep 1; sync

# ... and load the new ones
xinsmod videodev
xinsmod tuner		type=5
xinsmod msp34xx
xinsmod bttv		radio=1 card=1
#xinsmod tda98xx
#xinsmod tda8425
#xinsmod tea6300
