/etc/init.d/aumix is in aumix-common 2.9.1-2.
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 | #! /bin/sh
# aumix(-gtk) Save/restore mixer settings on bootup
# Original version by Leon Breedt <ljb@debian.org>
# Heavily edited by Eduard Bloch <blade@debian.org>
# Some changes (2002) by Bas Zoetekouw <bas@debian.org>
# Supports multiple devices with probing
### BEGIN INIT INFO
# Provides: aumix
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: udev
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Restore mixer settings from saved values.
### END INIT INFO
CONF=/etc/aumixrc
AUMIX=/usr/bin/aumix
DEFAULTFILE=/etc/default/aumix
KEYFILE=/etc/default/aumix.stop
. /lib/lsb/init-functions
# Create the locking directory
[ -d /var/lock/aumix/ ] || mkdir /var/lock/aumix
[ -x $AUMIX ] || exit 0
# handle /etc/defaults/aumix stuff
SAVEMIXER="yes" # save and restore mixer setting by default
HANDLEALSA="no" # do not save and restore if ALSA detected by default
[ -f $DEFAULTFILE ] && . $DEFAULTFILE
# exit silently
[ $SAVEMIXER = "no" -o $SAVEMIXER = "NO" ] && exit 0
# backward compatibility
if [ -f $KEYFILE ] ; then
log_warning_msg "Warning: use of $KEYFILE is obsolete."
log_warning_msg "Edit /etc/default/aumix instead."
log_warning_msg "Key file $KEYFILE detected, won't execute aumix."
exit 0
fi
export PATH=/usr/sbin:$PATH
export I=""
# check for loaded ALSA drivers and saved ALSA mixer settings (alsactl)
if [ -e /proc/asound -a -e /var/lib/alsa/asound.state -a \
\! \( $HANDLEALSA = "yes" -o $HANDLEALSA = "YES" \) ]; then
log_warning_msg "Saved ALSA mixer settings detected; aumix will not" \
"touch mixer."
exit 0
fi
# if we have devfs mounted and there are mixer devices, use it rather then
# try-and-error methods
if test -d /dev/sound/; then
MIXERS=`cd /dev/sound; ls mixer* 2>/dev/null`
mute ()
{
log_progress_msg "muting"
for x in $MIXERS; do
$AUMIX -d /dev/sound/$x -v 0
done
}
load ()
{
log_action_begin_msg "Restoring mixer settings"
for x in $MIXERS; do
$AUMIX -d /dev/sound/$x -f $CONF${x#mixer} -L >/dev/null
log_progress_msg "$x"
done
log_success_msg "done."
}
store ()
{
log_action_begin_msg "Saving mixer settings"
for x in $MIXERS; do
$AUMIX -d /dev/sound/$x -f $CONF${x#mixer} -S
log_progress_msg "$x"
done
}
else
# no devfs, probing
store ()
{
I=""
log_action_begin_msg "Saving mixer settings"
while $AUMIX -d /dev/mixer$I -f $CONF$I -S \
2>/dev/null >/dev/null; do
log_progress_msg "mixer$I"
test "x$I" = "x" && I=0
I=`expr $I + 1`
done
if [ -z "$I" ]; then
log_failure_msg "failed."
return 1;
fi
}
load ()
{
I=""
log_action_begin_msg "Restoring mixer settings"
while [ -f $CONF$I ] && $AUMIX -d /dev/mixer$I -f $CONF$I -L \
2>/dev/null >/dev/null; do
log_progress_msg "mixer$I"
test "x$I" = "x" && I=0
I=`expr $I + 1`
done
if [ -z "$I" ]; then
log_failure_msg "failed."
return 1;
else
log_success_msg "done."
fi
}
mute ()
{
I=""
log_progress_msg "muting"
while $AUMIX -d /dev/mixer$I -v 0 2>/dev/null >/dev/null; do
test "x$I" = "x" && I=0
I=`expr $I + 1`
done
}
fi
case "$1" in
start|restart|reload|force-reload)
if [ -f $CONF ]; then
rm -f /var/lock/aumix/saved
load
fi
;;
stop)
if [ -f /var/lock/aumix/saved ] ; then
log_warning_msg "Settings already stored and devices" \
"muted, not saving again"
else
if store; then
touch /var/lock/aumix/saved
mute
fi
fi
;;
save)
if [ -f /var/lock/aumix/saved ] ; then
log_warning_msg "Settings already stored and devices" \
"muted, not saving again"
else
store && log_success_msg "done."
fi
;;
*)
log_failure_msg "Usage: /etc/init.d/aumix {start|stop|save}"
exit 1
;;
esac
|