Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/alsa-utils/files/, media-sound/alsa-utils/
Date: Sun, 30 Jun 2019 12:37:09
Message-Id: 1561898207.2e6f547bbfb261f1e13dacd1ba441b554480aa1e.pacho@gentoo
1 commit: 2e6f547bbfb261f1e13dacd1ba441b554480aa1e
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 30 12:11:11 2019 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 30 12:36:47 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e6f547b
7
8 media-sound/alsa-utils: Use /run instead of /var/run
9
10 Closes: https://bugs.gentoo.org/685304
11 Package-Manager: Portage-2.3.67, Repoman-2.3.16
12 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
13
14 media-sound/alsa-utils/alsa-utils-1.1.9.ebuild | 2 +-
15 media-sound/alsa-utils/files/alsasound.initd-r8 | 87 +++++++++++++++++++++++++
16 2 files changed, 88 insertions(+), 1 deletion(-)
17
18 diff --git a/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild b/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild
19 index bcc1f868e6d..bfb1938f52b 100644
20 --- a/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild
21 +++ b/media-sound/alsa-utils/alsa-utils-1.1.9.ebuild
22 @@ -48,7 +48,7 @@ src_install() {
23 default
24 dodoc seq/*/README.*
25
26 - newinitd "${FILESDIR}"/alsasound.initd-r7 alsasound
27 + newinitd "${FILESDIR}"/alsasound.initd-r8 alsasound
28 newconfd "${FILESDIR}"/alsasound.confd-r4 alsasound
29
30 insinto /etc/modprobe.d
31
32 diff --git a/media-sound/alsa-utils/files/alsasound.initd-r8 b/media-sound/alsa-utils/files/alsasound.initd-r8
33 new file mode 100644
34 index 00000000000..2fe2347c377
35 --- /dev/null
36 +++ b/media-sound/alsa-utils/files/alsasound.initd-r8
37 @@ -0,0 +1,87 @@
38 +#!/sbin/openrc-run
39 +# Copyright 1999-2019 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +alsastatedir=/var/lib/alsa
43 +alsascrdir=/etc/alsa.d
44 +alsahomedir=/run/alsasound
45 +
46 +extra_commands="save restore"
47 +
48 +depend() {
49 + need localmount
50 + after bootmisc modules isapnp coldplug hotplug
51 +}
52 +
53 +restore() {
54 + ebegin "Restoring Mixer Levels"
55 +
56 + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
57 +
58 + if [ ! -r "${alsastatedir}/asound.state" ] ; then
59 + ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!"
60 + eend 0
61 + return 0
62 + fi
63 +
64 + local cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
65 + local CARDNUM
66 + for cardnum in ${cards}; do
67 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2
68 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2
69 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2
70 + [ -e /dev/snd/controlC${cardnum} ] || sleep 2
71 + alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \
72 + || ewarn "Errors while restoring defaults, ignoring"
73 + done
74 +
75 + for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do
76 + [ -e "${ossfile}" ] || continue
77 + # We use cat because I'm not sure if cp works properly on /proc
78 + local procfile=${ossfile##${alsastatedir}/oss}
79 + procfile="$(echo "${procfile}" | sed -e 's,_,/,g')"
80 + if [ -e /proc/asound/"${procfile}"/oss ] ; then
81 + cat "${ossfile}" > /proc/asound/"${procfile}"/oss
82 + fi
83 + done
84 +
85 + eend 0
86 +}
87 +
88 +save() {
89 + ebegin "Storing ALSA Mixer Levels"
90 +
91 + checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1
92 +
93 + mkdir -p "${alsastatedir}"
94 + if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then
95 + eerror "Error saving levels."
96 + eend 1
97 + return 1
98 + fi
99 +
100 + for ossfile in /proc/asound/card*/pcm*/oss; do
101 + [ -e "${ossfile}" ] || continue
102 + local device=${ossfile##/proc/asound/} ; device=${device%%/oss}
103 + device="$(echo "${device}" | sed -e 's,/,_,g')"
104 + mkdir -p "${alsastatedir}/oss/"
105 + cp "${ossfile}" "${alsastatedir}/oss/${device}"
106 + done
107 +
108 + eend 0
109 +}
110 +
111 +start() {
112 + if [ "${RESTORE_ON_START}" = "yes" ]; then
113 + restore
114 + fi
115 +
116 + return 0
117 +}
118 +
119 +stop() {
120 + if [ "${SAVE_ON_STOP}" = "yes" ]; then
121 + save
122 + fi
123 + return 0
124 +}