summaryrefslogtreecommitdiff
path: root/setup/SunOS/svc-oss.htm
diff options
context:
space:
mode:
Diffstat (limited to 'setup/SunOS/svc-oss.htm')
-rwxr-xr-xsetup/SunOS/svc-oss.htm55
1 files changed, 55 insertions, 0 deletions
diff --git a/setup/SunOS/svc-oss.htm b/setup/SunOS/svc-oss.htm
new file mode 100755
index 0000000..d45a124
--- /dev/null
+++ b/setup/SunOS/svc-oss.htm
@@ -0,0 +1,55 @@
+#!/sbin/sh
+#
+
+. /lib/svc/share/smf_include.sh
+
+# Generic runtime checks
+OSS_SERVICE=`echo $SMF_FMRI | sed 's/.*:\(.*\)/\1/'`
+
+if [ -z "$SMF_FMRI" ]; then
+ echo "Open Sound System service can only be started/stopped via the SMF framework"
+ exit $SMF_EXIT_ERR_NOSMF
+fi
+
+if [ -z "$OSS_SERVICE" ]; then
+ echo "Unable to parse service name from SMF FRMI $SMF_FRMI"
+ exit $SMF_EXIT_ERR_NOSMF
+fi
+
+#
+# Original script, refactored
+#
+
+if test -f /etc/oss.conf
+then
+ . /etc/oss.conf
+else
+ OSSLIBDIR=/usr/lib/oss
+fi
+
+oss_start() {
+ /usr/sbin/soundon > /dev/null 2>&1
+ # Somehow this is required overhere to prevent skipping
+ /usr/sbin/ossdevlinks
+}
+
+oss_stop() {
+ # Save mixer settings automatically if requested
+ if test -f $OSSLIBDIR/etc/userdefs && /usr/xpg4/bin/grep -q "autosave_mixer yes" $OSSLIBDIR/etc/userdefs
+ then
+ /usr/sbin/savemixer
+ fi
+}
+
+case $1 in
+'start')
+ oss_start
+ ;;
+'stop')
+ oss_stop
+ ;;
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac