freebsd-ports/audio/emu10kx/pkg-install

47 lines
1.2 KiB
Text
Raw Normal View History

#!/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
#============================================================