summaryrefslogtreecommitdiff
path: root/setup/SunOS/svc-oss.htm
blob: d45a124ac79f08ca9accd14884e0c8ffa121cf32 (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
#!/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