Re: [Tails-dev] Small patch to mute sound on boot time

Delete this message

Reply to this message
Autor: CAN Consulting
Data:  
Dla: tails-dev
Temat: Re: [Tails-dev] Small patch to mute sound on boot time
Hello,

> Also, how does it play vs. /etc/init.d/alsa-utils? Seems like that
> other initscript changes mute / levels and stuff too. You may want to
> use the LSB headers to make sure yours runs after alsa-utils, or use
> that other initscript levels restore features to achieve what you want
> to (would be perfect if possible).


Thank you! I attached a tiny patch in this mail.
It adds only three lines to alsa-utils and uses an already built-in function
in alsa-utils to mute all channels of the sound cards in a system.

Your idea seems to me much better choice than adding new
configuration files and scripts. Is there a (design/maintenance/...) reason
why there is only one patch file in the chroot_include-patches directory
(besides just not needing many patches)?
The only downside I see with this patch compared to a new init script is
that
whenever alsa-utils changes the patch has to be changed too. But then,
it's only a very small patch and can be adapted easily to alsa-utils
changes.

Tails doesn't build here for some reason (I will post the buildlog in a
separate mail),
the script ran as far as applying the attached alsa-utils
patch and I ran the init.d script manually on my system. It muted
all sound channels and seems to work as expected.


Bye! :-)


--JohnDoe

>From 85c93ee93e695c628db1928f1be96c03791fb579 Mon Sep 17 00:00:00 2001
From: use <user@localhost>
Date: Sun, 29 May 2011 02:02:26 +0200
Subject: [PATCH] Small change to alsa-utils initscript to initialize sound
cards muted.

---
config/chroot_local-patches/alsa-utils-patch.diff | 27 +++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
create mode 100644 config/chroot_local-patches/alsa-utils-patch.diff

diff --git a/config/chroot_local-patches/alsa-utils-patch.diff b/config/chroot_local-patches/alsa-utils-patch.diff
new file mode 100644
index 0000000..0fe94b3
--- /dev/null
+++ b/config/chroot_local-patches/alsa-utils-patch.diff
@@ -0,0 +1,27 @@
+--- chroot.orig/etc/init.d/alsa-utils    2010-10-04 14:14:10.000000000 -0400
++++ chroot/etc/init.d/alsa-utils    2011-05-28 18:33:23.558976360 -0400
+@@ -340,6 +340,7 @@
+         sanify_levels "$TARGET_CARD" || EXITSTATUS=1
+         restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
+     fi
++    mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
+     log_action_end_msg_and_exit "$EXITSTATUS"
+     ;;
+   stop)
+@@ -351,7 +352,7 @@
+     esac
+     card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
+     store_levels "$TARGET_CARD" || EXITSTATUS=1
+-    #mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
++    mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
+     log_action_end_msg_and_exit "$EXITSTATUS"
+     ;;
+   restart|force-reload)
+@@ -369,6 +370,7 @@
+     card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
+     preinit_levels "$TARGET_CARD"
+     sanify_levels "$TARGET_CARD"
++    mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
+     log_action_end_msg_and_exit "$?"
+     ;;
+   *)
-- 
1.7.4.4