[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 4b5e792f15b562d3f6317f96f5a5cd21fe28325d

Darren Salt linux at youmustbejoking.demon.co.uk
Sat Feb 7 15:02:52 UTC 2009


The following commit has been merged in the master branch:
commit c2c7ec2616bbdd112a00e11f99142afab3ea1377
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date:   Sat Feb 7 14:52:47 2009 +0000

    Move the amixer output parsing into a function, removing duplication; remove blank lines.

diff --git a/etc/acpi/lib/sound.sh b/etc/acpi/lib/sound.sh
index 08e82ad..399b519 100644
--- a/etc/acpi/lib/sound.sh
+++ b/etc/acpi/lib/sound.sh
@@ -1,19 +1,21 @@
+configureSoundFilter() {
+  $AMIXER |
+  grep -B1 "$1" |
+  sed -r "s/^(.*'([^']+)'.*|[^']+())$/\\2/; /^$/ d"
+}
 
 configureSound() {
 
     [ "$SOUND_LABEL" ] || {
-	 SOUND_LABEL="$($AMIXER | grep -B1 pvolume |
-			sed -r "s/^(.*'([^']+)'.*|[^']+())$/\\2/")"
+	 SOUND_LABEL="$(configureSoundFilter pvolume)"
     }
 
     [ "$SOUND_SWITCH" ] || {
-	 SOUND_SWITCH="$($AMIXER | grep -B1 pswitch |
-			sed -r "s/^(.*'([^']+)'.*|[^']+())$/\\2/")"
+	 SOUND_SWITCH="$(configureSoundFilter pswitch)"
     }
 
     [ "$SOUND_SWITCH_EXCLUSIVE" ] || {
-	 SOUND_SWITCH_EXCLUSIVE="$($AMIXER | grep -B1 ': pswitch$' |
-				sed -r "s/^(.*'([^']+)'.*|[^']+())$/\\2/")"
+	 SOUND_SWITCH_EXCLUSIVE="$(configureSoundFilter ': pswitch$')"
     }
 
     [ "$SOUND_VOLUME_STEP" ] || {

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-commits mailing list