summaryrefslogtreecommitdiff
path: root/audio/oss/files/oss.sh
blob: f423dad3bcfc44ef25a65426ac0e3c42aa993eab (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: oss.sh,v 1.3 2002/10/02 21:06:55 jlam Exp $
#
# PROVIDE: oss
# REQUIRE: aftermountlkm
# KEYWORD: shutdown

if [ -f /etc/rc.subr ]; then
	. /etc/rc.subr
fi

name="oss"
rcvar=$name
required_files="/etc/oss.conf @OSSLIBDIR@/devices.cfg"
start_cmd="oss_start"
stop_cmd="oss_stop"

oss_start()
{
	missing_files=
	for file in ${required_files}; do
		if [ ! -f "${file}" ]; then
			missing_files="${missing_files} ${file}"
		fi
	done
	if [ -z "${missing_files}" -a -x @PREFIX@/sbin/soundon ]; then
		@ECHO@ "Starting ${name}."
		@PREFIX@/sbin/soundon
	fi
}

oss_stop()
{
        if modstat -n oss >/dev/null; then
		if [ -x @PREFIX@/sbin/soundoff ]; then
			@ECHO@ "Stopping ${name}."
			@PREFIX@/sbin/soundoff
		fi
	fi
}


if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
then
	load_rc_config $name
	run_rc_command "$1"
else
	$start_cmd
fi