This file is indexed.

/etc/init.d/oss4-base is in oss4-base 4.2-build2007-2.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
#
# Starts the OSS sound driver
#
### BEGIN INIT INFO
# Provides:          oss4-base
# Required-Start:    $remote_fs $local_fs
# Required-Stop:     $remote_fs $local_fs
# Default-Start:     S
# Default-Stop:      0 1 6
# Short-Description: Start and Stop the OSS4 subsystem
### END INIT INFO

OSSETCDIR=/etc/oss4
OSSVARDIR=/var/lib/oss4

. /etc/oss.conf
. /lib/lsb/init-functions

# Exit if oss4 is not installed
test -x /usr/sbin/ossdetect || exit 0

echo_procs_using_sound()
{
	echo $( fuser /dev/mixer* /dev/dsp* /dev/midi* /dev/oss/*/* 2>/dev/null )
}

kill_procs_using_sound()
{
	procs_using_sound="$(echo_procs_using_sound)"

	if [ "$procs_using_sound" ] ; then
		echo -n "Terminating processes:"
		for attempt in 1 2 3 4 ; do
			echo -n " ${procs_using_sound}"
			kill $procs_using_sound || :
			sleep 1
			procs_using_sound="$(echo_procs_using_sound)"
			[ "$procs_using_sound" ] || break
		done
		# Either no more procs using sound or attempts ran out
		if [ "$procs_using_sound" ] ; then
			echo -n " (with SIGKILL:) ${procs_using_sound}"
			kill -9 $procs_using_sound || :
			sleep 1
		fi
		procs_using_sound="$(echo_procs_using_sound)"
		if [ "$procs_using_sound" ] ; then
			echo " (failed: processes still using sound devices: $(echo_with_command_names $procs_using_sound))."
			return 1
		fi
		echo "."
	fi
	return 0
}

unload_modules()
{
	procs_using_sound="$(echo_procs_using_sound)"

	if test "$procs_using_sound " != " "
	then
	  log_action_end_msg 2 'Some applications are still using OSS'
	  exit 2
	fi

	# Unload oss drivers
	for n in `cat $OSSETCDIR/installed_drivers | sed 's/#.*//'`
	do
		if ! /sbin/rmmod $n
		then
			log_warning_msg "Unloading module $n failed - ignored"
		fi
	done

	if ! /sbin/rmmod osscore
	then
		log_action_end_msg 3 'Cannot unload the OSS driver modules'
		exit 3
	fi
}

case "$1" in
  start)
	log_begin_msg 'Starting Open Sound System: '

	# Check if OSS is already running
	if test -f /proc/opensound/devfiles
	then
		log_action_end_msg 0 'OSS is already loaded'
		exit 0
	fi

	# Check if oss kernel modules are installed
	if ! test -f /lib/modules/`uname -r`/kernel/oss4/osscore.ko && ! test -f /lib/modules/`uname -r`/updates/dkms/osscore.ko
	then
		log_action_end_msg 1 'No kernel modules detected'
		exit 0
	fi

	# Detect hardware
	if ! test -f $OSSETCDIR/installed_drivers
	then
		/usr/sbin/ossdetect -v
	fi
	if ! test -f $OSSETCDIR/installed_drivers
	then
		log_action_end_msg 10 "No $OSSETCDIR/installed_drivers - cannot continue (problem with ossdetect?)"
		exit 10
	fi

	# Load osscore
	OPTIONS=
	if test -f $OSSETCDIR/conf/osscore.conf
	then
	  OPTIONS="`grep -v -h '^#' $OSSETCDIR/conf/osscore.conf|sed 's/ //g'`"
	fi
	if ! /sbin/modprobe osscore $OPTIONS
	then
		log_action_end_msg 60 "Cannot load the osscore module"
		exit 60
	fi

	# Load oss drivers
	for n in `cat $OSSETCDIR/installed_drivers | sed 's/#.*//'`
	do
		OPTIONS=

		if test -f $OSSETCDIR/conf/$n.conf
		then
		  OPTIONS="`grep -v -h '^#' $OSSETCDIR/conf/$n.conf|sed 's/ //g'`"
		fi

		if ! /sbin/modprobe $n $OPTIONS
		then
			log_warning_msg "Loading module $n failed - ignored"
		fi
	done

	# Check if everything is OK
	if ! test -f /proc/opensound/devfiles
	then
		log_action_end_msg 70 'OSS Core module refused to start'
		exit 70
	fi

	# Create device file
	/usr/sbin/ossdetect -d -m 660 -g audio

	# Create basic links
	/usr/sbin/ossdevlinks
	if test -f $OSSVARDIR/legacy_devices
	then
		sh $OSSVARDIR/legacy_devices
	fi

	/usr/sbin/savemixer -L

	log_action_end_msg 0
	;;

  stop)
	log_begin_msg 'Stopping Open Sound System: '
	if ! test -f /proc/opensound/devfiles
	then
		log_action_end_msg 0 'OSS not loaded'
		exit 0
	fi

	/usr/sbin/savemixer

	log_action_end_msg 0
	;;

  unload)
	log_begin_msg 'Unloading Open Sound System kernel modules: '

	if ! test -f /proc/opensound/devfiles
	then
		log_action_end_msg 0 'OSS not loaded'
		exit 0
	fi

	/usr/sbin/savemixer
	unload_modules
	log_action_end_msg 0
	;;

  force-unload)
	log_begin_msg 'Unloading Open Sound System kernel modules: '

	if ! test -f /proc/opensound/devfiles
	then
		log_action_end_msg 0 'OSS not loaded'
		exit 0
	fi

	/usr/sbin/savemixer
	kill_procs_using_sound
	unload_modules
	log_action_end_msg 0
	;;

  restart)
	$0 stop
	sleep 1
	$0 start
	;;

  force-reload)
	$0 force-unload
	sleep 1
	$0 start
	;;

  *)
	echo "Usage: $0 {start|stop|unload|force-unload|restart|force-reload}"
	exit 3
esac