From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D4C5A138335 for ; Sun, 30 Jun 2019 12:37:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 70F6FE0887; Sun, 30 Jun 2019 12:37:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 43BE8E0887 for ; Sun, 30 Jun 2019 12:37:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 066AC346D0E for ; Sun, 30 Jun 2019 12:37:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 68FAA2A5 for ; Sun, 30 Jun 2019 12:37:03 +0000 (UTC) From: "Pacho Ramos" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Pacho Ramos" Message-ID: <1561898207.2e6f547bbfb261f1e13dacd1ba441b554480aa1e.pacho@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/alsa-utils/files/, media-sound/alsa-utils/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-sound/alsa-utils/alsa-utils-1.1.9.ebuild media-sound/alsa-utils/files/alsasound.initd-r8 X-VCS-Directories: media-sound/alsa-utils/ media-sound/alsa-utils/files/ X-VCS-Committer: pacho X-VCS-Committer-Name: Pacho Ramos X-VCS-Revision: 2e6f547bbfb261f1e13dacd1ba441b554480aa1e X-VCS-Branch: master Date: Sun, 30 Jun 2019 12:37:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1dce176f-4e7f-4867-b1cb-9847c06f4e40 X-Archives-Hash: 7e5d28d98a788991fa55c5500f5e7514 commit: 2e6f547bbfb261f1e13dacd1ba441b554480aa1e Author: Pacho Ramos gentoo org> AuthorDate: Sun Jun 30 12:11:11 2019 +0000 Commit: Pacho Ramos gentoo org> CommitDate: Sun Jun 30 12:36:47 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e6f547b 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 gentoo.org> media-sound/alsa-utils/alsa-utils-1.1.9.ebuild | 2 +- media-sound/alsa-utils/files/alsasound.initd-r8 | 87 +++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) 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 bcc1f868e6d..bfb1938f52b 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 00000000000..2fe2347c377 --- /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 +}