diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-05-03 21:08:42 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-05-03 21:08:42 +0400 |
commit | 1058def8e7827e56ce4a70afb4aeacb5dc44148f (patch) | |
tree | 4495d23e7b54ab5700e3839081e797c1eafe0db9 /setup/SunOS/sbin/soundoff | |
download | oss4-upstream.tar.gz |
Imported Upstream version 4.2-build2006upstream/4.2-build2006upstream
Diffstat (limited to 'setup/SunOS/sbin/soundoff')
-rwxr-xr-x | setup/SunOS/sbin/soundoff | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/setup/SunOS/sbin/soundoff b/setup/SunOS/sbin/soundoff new file mode 100755 index 0000000..432b65c --- /dev/null +++ b/setup/SunOS/sbin/soundoff @@ -0,0 +1,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 |