alsa-utils: added an openrc service to save/restore mixer settings.
This commit is contained in:
parent
a59f5dd92a
commit
804dc32abd
2 changed files with 42 additions and 1 deletions
33
srcpkgs/alsa-utils/files/alsamixer.rc
Normal file
33
srcpkgs/alsa-utils/files/alsamixer.rc
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/sbin/runscript
|
||||||
|
|
||||||
|
alsa_statedir=/var/lib/alsa
|
||||||
|
|
||||||
|
depend()
|
||||||
|
{
|
||||||
|
need localmount
|
||||||
|
after bootmisc modules coldplug hotplug
|
||||||
|
}
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
ebegin "Restoring ALSA mixer settings"
|
||||||
|
|
||||||
|
[ ! -r ${alsa_statedir}/asound.state ] && eend 0
|
||||||
|
|
||||||
|
cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
|
||||||
|
for cardnum in ${cards}; do
|
||||||
|
alsactl -f ${alsa_statedir}/asound.state restore ${cardnum} \
|
||||||
|
|| ewarn "Errors while restoring defaults, ignoring"
|
||||||
|
done
|
||||||
|
eend 0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
ebegin "Storing ALSA mixer settings"
|
||||||
|
|
||||||
|
[ ! -d ${alsa_statedir} ] && mkdir -p ${alsa_statedir}
|
||||||
|
|
||||||
|
alsactl -f ${alsa_statedir}/asound.state store
|
||||||
|
eend $?
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
# Template build file for 'alsa-utils'.
|
# Template build file for 'alsa-utils'.
|
||||||
pkgname=alsa-utils
|
pkgname=alsa-utils
|
||||||
version=1.0.24.2
|
version=1.0.24.2
|
||||||
revision=1
|
revision=2
|
||||||
distfiles="ftp://ftp.alsa-project.org/pub/utils/$pkgname-$version.tar.bz2"
|
distfiles="ftp://ftp.alsa-project.org/pub/utils/$pkgname-$version.tar.bz2"
|
||||||
build_style=gnu_configure
|
build_style=gnu_configure
|
||||||
configure_args="--with-systemdsystemunitdir=/lib/systemd/system"
|
configure_args="--with-systemdsystemunitdir=/lib/systemd/system"
|
||||||
|
@ -17,6 +17,8 @@ long_desc="
|
||||||
This package includes the ALSA runtime utilities
|
This package includes the ALSA runtime utilities
|
||||||
"
|
"
|
||||||
|
|
||||||
|
openrc_services="alsamixer default true"
|
||||||
|
|
||||||
Add_dependency run alsa-lib
|
Add_dependency run alsa-lib
|
||||||
Add_dependency run glibc
|
Add_dependency run glibc
|
||||||
Add_dependency run ncurses-libs
|
Add_dependency run ncurses-libs
|
||||||
|
@ -25,3 +27,9 @@ Add_dependency build pkg-config
|
||||||
Add_dependency build alsa-lib-devel
|
Add_dependency build alsa-lib-devel
|
||||||
Add_dependency build gettext
|
Add_dependency build gettext
|
||||||
Add_dependency build xmlto
|
Add_dependency build xmlto
|
||||||
|
|
||||||
|
post_install()
|
||||||
|
{
|
||||||
|
# OpenRC service to save/restore mixer settings.
|
||||||
|
vinstall ${FILESDIR}/alsamixer.rc 755 etc/init.d alsamixer
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue