#
# Speaker driver installation script
#
TMP=/tmp/speaker.err
ERR1=" Errors have been written to the file $TMP."
ERR2=" The Speaker Driver software was not installed."

echo "Installing Speaker Driver Software Package"

/etc/conf/bin/idcheck -p speaker 2>$TMP
if [ $? != 0 ]
then
	echo "The speaker package is already at least partly installed.
	Removing the old version now..."
	/etc/conf/bin/idinstall -d speaker
fi

/etc/conf/bin/idinstall -a -k speaker 2>>$TMP
if [ $? != 0 ]
then
	message "There was an error during package installation. $ERR1 $ERR2"
	exit 1
fi

/etc/conf/bin/idbuild 2>>$TMP
if [ $? != 0 ]
then
	message "There was an error during kernel reconfiguration. $ERR1 $ERR2"
	exit 1
fi

rm -f $TMP

cp spkr.h /usr/include/sys/spkr.h

echo "Performing shutdown..."
cd /; exec /etc/shutdown -g0 -y
