-#!/bin/bash
+#!/bin/sh
#
# alsasound This shell script takes care of starting and stopping
# ALSA sound driver.
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
-# For RedHat 5.0+:
+# For Polish Linux Distribution:
# chkconfig: 2345 87 14
# description: ALSA driver
#
MODULES_CONF=/etc/conf.modules
fi
-function start() {
+driver_start()
+{
#
# insert all sound modules
#
+ if OLDLOGLEV=$(cat /proc/sys/kernel/printk | awk '{print $1}' 2> /dev/null); then
+ /sbin/loglevel 1
+ fi
cat $MODULES_CONF | grep -v "off" | \
grep -E "^alias.+snd-card-[[:digit:]]" | \
awk '{print $3}' | \
/sbin/modprobe $line; \
ok; \
done
+ if [ -n "$OLDLOGLEV" ]; then
+ /sbin/loglevel "$OLDLOGLEV"
+ fi
#
# restore driver settings
#
fi
}
-function detect_stop() {
+detect_stop()
+{
#
# remove all sound modules
#
done
}
-function stop() {
+driver_stop()
+{
#
# store driver settings
#
if [ -x $alsactl ]; then
$alsactl store
else
- show "!!!alsactl not found!!! "; fail
+ show '!!!alsactl not found!!!'; fail
fi
#
# remove all sound modules
detect_stop
}
-function detect_start() {
+detect_start()
+{
#
# run only detect module
#
start)
# Start driver.
if [ ! -d /proc/asound ]; then
- start
+ driver_start
if [ -d /proc/asound ] && [ -d /var/lock/subsys ]; then
touch /var/lock/subsys/alsasound
fi
else
if [ -f /proc/asound/detect ]; then
- show "Shutting down sound detect module: "
+ show "Shutting down sound detect module:"
detect_stop
ok
- start
+ driver_start
if [ -d /proc/asound ] && [ -d /var/lock/subsys ]; then
touch /var/lock/subsys/alsasound
fi
else
- show "ALSA driver is already running "; fail
+ show "ALSA driver is already running"; fail
fi
fi
;;
stop)
# Stop daemons.
if [ -d /proc/asound ]; then
- show "Shutting down sound driver: "
+ show "Shutting down sound driver:"
if [ -f /proc/asound/detect ]; then
detect_stop
else
- stop
+ driver_stop
fi
+ (rmmod isapnp; rmmod soundcore) 2> /dev/null
if [ -d /var/lock/subsys ]; then
rm -f /var/lock/subsys/alsasound
fi
# Start driver only in detect mode.
if [ -d /proc/asound ]; then
if [ -f /proc/asound/detect ]; then
- show "ALSA is already running detection mode "; fail
+ show "ALSA is already running detection mode"; fail
exit 0
else
- show "Shutting down sound driver: "
- stop
+ show "Shutting down sound driver:"
+ driver_stop
ok
fi
fi
- show "Starting sound detect module: "
+ show "Starting sound detect module:"
detect_start
ok
if [ -d /var/lock/subsys ]; then