~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#
#       /etc/rc.d/init.d/oss
#
# Starts the OSS sound driver
#
# chkconfig: 2345 80 20
# description: Open Sound System for Linux (OSS/Linux) is a \
# commercial quality sound driver distributed by 4Front Technologies \
# (http://www.opensound.com).

### BEGIN INIT INFO
# Provides: oss
# Required-Start: $local_fs $remote_fs 
# Should-Start: 
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start OSS
### END INIT INFO

# Source function library.
if test -f /lib/lsb/init-functions
then
. /lib/lsb/init-functions
fi

if test -f /etc/rc.d/init.d/functions
then
. /etc/rc.d/init.d/functions
fi

# Add oss configuration.
. /etc/oss.conf

RETVAL=0

#
#       See how we were called.
#
case "$1" in
  start)
        # Check if OSS is already running
        echo -n 'Starting Open Sound System: '
        if ! test -f /usr/sbin/soundon
	then
		exit 0
	fi

	if test -f $OSSLIBDIR/starting
	then
		ls -l $OSSLIBDIR/starting
		echo Previous start of OSS crashed the system
		echo Please resolve the situation and remove file
		echo \"$OSSLIBDIR/starting\". Then start OSS by
		echo running soundon
		exit 0
	fi

	if ! /usr/sbin/soundon
	then
	  echo Starting OSS failed
	fi
	rm -f $OSSLIBDIR/starting
        ;;
  stop)
        echo -n 'Stopping Open Sound System: '

	/usr/sbin/savemixer
	exit 0
        ;;
  restart)
        $0 stop
	/usr/sbin/soundoff
        $0 start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac