8b0303d490
This driver is alternative to snd_emu10k1 and support complex mixer settings, analog/digital switch, S/PDIF passthrough PR: 84653 Submitted by: michaels@sdf.lonestar.org
46 lines
1.2 KiB
Bash
46 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
[ "$2" != "POST-INSTALL" ] && exit 0
|
|
|
|
#============================================================
|
|
# POST-INSTALL
|
|
#============================================================
|
|
DRIVERNAME=snd_emu10kx
|
|
|
|
# Ask user about installing driver
|
|
echo -n "Do you want to install $DRIVERNAME driver and load it on boot time? [y/n]: "
|
|
read RES
|
|
echo
|
|
|
|
if [ x"$RES" = x"y" ] ; then
|
|
|
|
# Unload the driver
|
|
kldstat -n $DRIVERNAME > /dev/null 2>&1; RESULT=$?
|
|
if [ ${RESULT} -eq 0 ]; then
|
|
kldunload -n $DRIVERNAME > /dev/null 2>&1; RESULT=$?
|
|
if [ ${RESULT} -ne 0 ]; then
|
|
echo "ERROR: Failed to unload the $DRIVERNAME module!"
|
|
echo "ERROR: Is $DRIVERNAME.ko in use?"
|
|
exit 1;
|
|
fi
|
|
fi
|
|
|
|
# Load the driver
|
|
kldload $DRIVERNAME > /dev/null 2>&1 ; RESULT=$?
|
|
if [ ${RESULT} -ne 0 ]; then
|
|
echo "ERROR: Failed to load the $DRIVERNAME module!"
|
|
exit 1;
|
|
fi
|
|
|
|
# Have the driver load at boot
|
|
grep ${DRIVERNAME}_load /boot/loader.conf > /dev/null 2>&1; RESULT=$?
|
|
if [ ${RESULT} -eq 0 ]; then
|
|
# Present.
|
|
sed -e "s/${DRIVERNAME}_load.*/${DRIVERNAME}_load=\"YES\"/g" -i.orig /boot/loader.conf
|
|
else
|
|
# Not present.
|
|
echo "${DRIVERNAME}_load=\"YES\"" >> /boot/loader.conf
|
|
fi
|
|
|
|
fi
|
|
#============================================================
|