A few small cleanups:
1. Add the shutdown keyword so that the script is run at shutdown time, and the mixer* files are saved. 2. Twiddle whitespace. 3. Remove an unecessary function, and therefore collapse one variable.
This commit is contained in:
parent
97062607cd
commit
af85ab16a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127478
@ -29,7 +29,7 @@
|
||||
|
||||
# PROVIDE: mixer
|
||||
# REQUIRE: LOGIN usbd
|
||||
# KEYWORD: FreeBSD nojail
|
||||
# KEYWORD: FreeBSD nojail shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
@ -44,29 +44,19 @@ extra_commands="reload"
|
||||
#
|
||||
list_mixers()
|
||||
{
|
||||
|
||||
( cd /dev ; ls mixer* 2>/dev/null )
|
||||
}
|
||||
|
||||
#
|
||||
# Echo state file name for an individual mixer ($1) to stdout
|
||||
#
|
||||
mixer_statefile()
|
||||
{
|
||||
echo "/var/db/${1}-state"
|
||||
}
|
||||
|
||||
#
|
||||
# Save state of an individual mixer specified as $1
|
||||
#
|
||||
mixer_save()
|
||||
{
|
||||
local file dev
|
||||
local dev
|
||||
|
||||
dev="/dev/${1}"
|
||||
file=`mixer_statefile $1`
|
||||
if [ -r ${dev} ]; then
|
||||
/usr/sbin/mixer -f ${dev} -s > ${file} 2>/dev/null
|
||||
/usr/sbin/mixer -f ${dev} -s > /var/db/${1}-state 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
@ -78,7 +68,7 @@ mixer_restore()
|
||||
local file dev
|
||||
|
||||
dev="/dev/${1}"
|
||||
file=`mixer_statefile $1`
|
||||
file="/var/db/${1}-state"
|
||||
if [ -r ${dev} -a -r ${file} ]; then
|
||||
/usr/sbin/mixer -f ${dev} `cat ${file}` > /dev/null
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user