blob: 432b65c5abb78796252feb6972b723d58a100098 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/sh
LOG=/var/log/soundoff.log
rm -f $LOG
if test "`/usr/sbin/modinfo|grep OSS` " = " "
then
exit 0
fi
PIDLIST="`fuser /dev/mixer* /dev/dsp* /dev/midi* /dev/oss/*/* 2>/dev/null`"
if test ! "$PIDLIST " = " "
then
echo
echo 'Error: OSS devices are in use by the following application(s)'
echo
for n in $PIDLIST
do
ps -p $n |grep -v PID
done
echo
echo Please terminate these applications and try soundoff again
echo
exit 1
fi
# Save mixer settings automatically
/usr/sbin/savemixer
echo Modules to be unloaded >> $LOG
/usr/sbin/modinfo|grep OSS >> $LOG
# Perform three iterations since certain drivers may depend on each other
if test -f /etc/oss/installed_drivers
then
for i in 1 2 3 4 5
do
for n in `cat /etc/oss/installed_drivers | sed 's/ .*//'`
do
N=`modinfo|grep " $n "|sed 's/^ //'|sed 's/ .*//'`
if test "$N " != " "
then
echo Unload $n/$N>> $LOG
/usr/sbin/modunload -i $N >> $LOG 2>&1
fi
done
done
fi
#remove the osscore module that isn't listed in installed_drivers
N=`modinfo|grep " osscore "|sed 's/^ //'|sed 's/ .*//'`
echo Unload osscore >> $LOG
/usr/sbin/modunload -i $N >> $LOG 2>&1
#remove the osscommon module that isn't listed in installed_drivers
N=`modinfo|grep " osscommon "|sed 's/^ //'|sed 's/ .*//'`
echo Unload osscommon >> $LOG
/usr/sbin/modunload -i $N >> $LOG 2>&1
if test "`/usr/sbin/modinfo|grep OSS` " = " "
then
exit 0
fi
echo Modules left >> $LOG
/usr/sbin/modinfo|grep OSS >> $LOG
exit 0
|