aboutsummaryrefslogtreecommitdiffstats
path: root/audio/emu10kx/pkg-deinstall
blob: 7bc92fe166a68558fbebb4a09ce1bd6ee8272bf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

[ "$2" != "DEINSTALL" ] && exit 0

#============================================================
# DEINSTALL
#============================================================
DRIVERNAME=snd_emu10kx

# 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

# Remove the driver
rm /boot/kernel/$DRIVERNAME.ko

# Remove the driver from loader.conf
grep ${DRIVERNAME}_load /boot/loader.conf > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
    sed -e /${DRIVERNAME}_load.*/d -i.orig /boot/loader.conf
fi
#============================================================