diff options
author | Pacho Ramos <pacho@gentoo.org> | 2019-06-30 14:11:11 +0200 |
---|---|---|
committer | Pacho Ramos <pacho@gentoo.org> | 2019-06-30 14:36:47 +0200 |
commit | 2e6f547bbfb261f1e13dacd1ba441b554480aa1e (patch) | |
tree | 6b2b62c86d187e394e82b073efaafc29aae7c080 | |
parent | package.mask: Remove boost-1.70 mask (diff) | |
download | gentoo-2e6f547bbfb261f1e13dacd1ba441b554480aa1e.tar.gz gentoo-2e6f547bbfb261f1e13dacd1ba441b554480aa1e.tar.bz2 gentoo-2e6f547bbfb261f1e13dacd1ba441b554480aa1e.zip |
media-sound/alsa-utils: Use /run instead of /var/run
Closes: https://bugs.gentoo.org/685304
Package-Manager: Portage-2.3.67, Repoman-2.3.16
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
-rw-r--r-- | media-sound/alsa-utils/alsa-utils-1.1.9.ebuild | 2 | ||||
-rw-r--r-- | media-sound/alsa-utils/files/alsasound.initd-r8 | 87 |
2 files changed, 88 insertions, 1 deletions
diff --git a/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild b/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild index bcc1f868e6d6..bfb1938f52be 100644 --- a/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild +++ b/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild @@ -48,7 +48,7 @@ src_install() { default dodoc seq/*/README.* - newinitd "${FILESDIR}"/alsasound.initd-r7 alsasound + newinitd "${FILESDIR}"/alsasound.initd-r8 alsasound newconfd "${FILESDIR}"/alsasound.confd-r4 alsasound insinto /etc/modprobe.d diff --git a/media-sound/alsa-utils/files/alsasound.initd-r8 b/media-sound/alsa-utils/files/alsasound.initd-r8 new file mode 100644 index 000000000000..2fe2347c3773 --- /dev/null +++ b/media-sound/alsa-utils/files/alsasound.initd-r8 @@ -0,0 +1,87 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +alsastatedir=/var/lib/alsa +alsascrdir=/etc/alsa.d +alsahomedir=/run/alsasound + +extra_commands="save restore" + +depend() { + need localmount + after bootmisc modules isapnp coldplug hotplug +} + +restore() { + ebegin "Restoring Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + if [ ! -r "${alsastatedir}/asound.state" ] ; then + ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!" + eend 0 + return 0 + fi + + local cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)" + local CARDNUM + for cardnum in ${cards}; do + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2 + alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \ + || ewarn "Errors while restoring defaults, ignoring" + done + + for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do + [ -e "${ossfile}" ] || continue + # We use cat because I'm not sure if cp works properly on /proc + local procfile=${ossfile##${alsastatedir}/oss} + procfile="$(echo "${procfile}" | sed -e 's,_,/,g')" + if [ -e /proc/asound/"${procfile}"/oss ] ; then + cat "${ossfile}" > /proc/asound/"${procfile}"/oss + fi + done + + eend 0 +} + +save() { + ebegin "Storing ALSA Mixer Levels" + + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1 + + mkdir -p "${alsastatedir}" + if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then + eerror "Error saving levels." + eend 1 + return 1 + fi + + for ossfile in /proc/asound/card*/pcm*/oss; do + [ -e "${ossfile}" ] || continue + local device=${ossfile##/proc/asound/} ; device=${device%%/oss} + device="$(echo "${device}" | sed -e 's,/,_,g')" + mkdir -p "${alsastatedir}/oss/" + cp "${ossfile}" "${alsastatedir}/oss/${device}" + done + + eend 0 +} + +start() { + if [ "${RESTORE_ON_START}" = "yes" ]; then + restore + fi + + return 0 +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ]; then + save + fi + return 0 +} |