summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/oss-sound/rc.oss-linux-free
diff options
context:
space:
mode:
authorCecil Hugh Watson <knoppmyth@gmail.com>2008-11-30 04:11:03 (GMT)
committerCecil Hugh Watson <knoppmyth@gmail.com>2008-11-30 04:11:03 (GMT)
commitf78fc8e0364cb99bf0b3c2fc941ba85c2fe5944f (patch)
tree35b4ab3030640a144537124112e3d65d138672f5 /abs/mv-core/oss-sound/rc.oss-linux-free
parentfba7ea15ad46f8655bf17ab4c1cc5a8228d39e1b (diff)
parentf0da28db238a7c58552446e2d87bae48a0f9718b (diff)
downloadlinhes_pkgbuild-f78fc8e0364cb99bf0b3c2fc941ba85c2fe5944f.zip
linhes_pkgbuild-f78fc8e0364cb99bf0b3c2fc941ba85c2fe5944f.tar.gz
linhes_pkgbuild-f78fc8e0364cb99bf0b3c2fc941ba85c2fe5944f.tar.bz2
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/mv-core/oss-sound/rc.oss-linux-free')
-rwxr-xr-xabs/mv-core/oss-sound/rc.oss-linux-free73
1 files changed, 73 insertions, 0 deletions
diff --git a/abs/mv-core/oss-sound/rc.oss-linux-free b/abs/mv-core/oss-sound/rc.oss-linux-free
new file mode 100755
index 0000000..48b65e0
--- /dev/null
+++ b/abs/mv-core/oss-sound/rc.oss-linux-free
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+terminateapps() {
+ # Thanks to the Gentoo ebuild/start script for the following
+ # http://bugs.gentoo.org/show_bug.cgi?id=184123
+ # http://bugs.gentoo.org/attachment.cgi?id=153689
+ devs=`perl -e '{while (<>) {m/^(\S*)/; print "/dev/$1\n"}}' \
+ < /proc/opensound/devfiles`
+ fuser -k ${devs} >/dev/null 2>/dev/null
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting OSS/Open source driver"
+ # start
+ /usr/sbin/soundon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ grep '^softoss' /proc/modules >/dev/null 2>/dev/null
+ if [ $? -eq 0 ]; then
+ stat_busy "Replacing old \"softoss\" module with \"vmix\""
+ rmmod softoss
+ modprobe vmix
+ sed -i 's/^softoss.*$/vmix/' /usr/lib/oss/etc/installed_drivers
+ fi
+ add_daemon oss-linux-free
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Saving OSS mixer"
+ /usr/sbin/savemixer
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ grep '^"cuckoo"' /proc/modules >/dev/null 2>/dev/null
+ if [ $? -eq 0 ]; then
+ stat_busy "Removing \"cuckoo\" module"
+ rmmod cuckoo
+ fi
+ stat_busy "Killing processes using OSS"
+ terminateapps
+ stat_done
+ # It doesn't matter if it didnt kill anything!
+ stat_busy "Stopping OSS/Open source driver"
+ /usr/sbin/soundoff
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon oss-linux-free
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ terminateapps)
+ stat_busy "Killing processes using OSS"
+ terminateapps
+ stat_done
+ # It doesn't matter if it didnt kill anything!
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|terminateapps}"
+esac