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

Darren Salt linux at youmustbejoking.demon.co.uk
Wed Feb 25 15:47:31 UTC 2009


The following commit has been merged in the master branch:
commit ad37fe7f89c7c4d65199dd2c629e0829114a5cee
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date:   Wed Feb 25 14:55:42 2009 +0000

    Cache control names; avoid calling amixer except to actually alter controls.

diff --git a/debian/dirs b/debian/dirs
index 06ff777..ad38e46 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -3,4 +3,6 @@ etc/acpi/actions
 etc/acpi/events
 etc/acpi/lib
 etc/modprobe.d
+etc/alsa/modprobe-post-install.d
 usr/share/eeepc-acpi-scripts
+var/cache/eeepc-acpi-scripts
diff --git a/debian/postinst b/debian/postinst
index bc8bff2..32d9c80 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,6 +5,9 @@ set -e
 case "$1" in
     configure)
         invoke-rc.d acpid restart>/dev/null
+        if [ -x /etc/alsa/modprobe-post-install.d/eeepc-acpi-scripts ]; then
+          /etc/alsa/modprobe-post-install.d/eeepc-acpi-scripts
+        fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/rules b/debian/rules
index dc9eb85..54ef99b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -32,6 +32,7 @@ install: build
 	install -m 0755 etc/acpi/actions/* $(TMP)/etc/acpi/actions
 	install -m 0644 etc/acpi/events/* $(TMP)/etc/acpi/events
 	install -m 0644 etc/acpi/lib/* $(TMP)/etc/acpi/lib
+	install -m 0755 etc/alsa/modprobe-post-install.d/* $(TMP)/etc/alsa/modprobe-post-install.d
 	install -m 0644 etc/modprobe.d/* $(TMP)/etc/modprobe.d
 	install -m 0644 functions.sh $(TMP)/usr/share/$(PKG)/
 
diff --git a/etc/acpi/actions/volume.sh b/etc/acpi/actions/volume.sh
index 465574b..8d382f3 100755
--- a/etc/acpi/actions/volume.sh
+++ b/etc/acpi/actions/volume.sh
@@ -8,7 +8,6 @@ FUNC_LIB=/usr/share/$PKG/functions.sh
 DEFAULT=/etc/default/$PKG
 [ -e $FUNC_LIB ] || exit 0
 
-if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
 . $FUNC_LIB
 . /etc/acpi/lib/notify.sh
 . /etc/acpi/lib/sound.sh
@@ -21,13 +20,6 @@ EOF
     exit 1
 }
 
-AMIXER=/usr/bin/amixer
-
-if ! [ -x $AMIXER ]; then
-    echo "$AMIXER not available" >&2
-    exit 1
-fi
-
 configureSound
 
 show_muteness() {
diff --git a/etc/acpi/lib/sound.sh b/etc/acpi/lib/sound.sh
index 6319bcb..9f2497b 100644
--- a/etc/acpi/lib/sound.sh
+++ b/etc/acpi/lib/sound.sh
@@ -1,6 +1,21 @@
 # Parse amixer output for a regexp (first parameter).
 # Some controls are blacklisted; for this, we use a set of fixed strings in
 # /etc/acpi/lib/eeepc-amixer-blacklist. (No wildcards or regexps.)
+
+PKG=eeepc-acpi-scripts
+DEFAULT=/etc/default/$PKG
+SOUND_FILE=/var/cache/$PKG/sound
+AMIXER=/usr/bin/amixer
+
+[ -e "$SOUND_FILE" ] && . "$SOUND_FILE"
+[ -e "$DEFAULT" ] && . "$DEFAULT"
+[ -x "$AMIXER" ] || exit 1
+
+[ "$SOUND_LABEL" = '' ] && SOUND_LABEL="$DEF_SOUND_LABEL"
+[ "$SOUND_SWITCH" = '' ] && SOUND_SWITCH="$DEF_SOUND_SWITCH"
+[ "$SOUND_SWITCH_EXCLUSIVE" = '' ] && SOUND_SWITCH_EXCLUSIVE="$DEF_SOUND_SWITCH_EXCLUSIVE"
+[ "$SOUND_VOLUME_STEP" = '' ] && SOUND_VOLUME_STEP="$DEF_SOUND_VOLUME_STEP"
+
 configureSoundFilter() {
   $AMIXER |
   grep -B1 "$1" |
diff --git a/etc/alsa/modprobe-post-install.d/eeepc-acpi-scripts b/etc/alsa/modprobe-post-install.d/eeepc-acpi-scripts
new file mode 100644
index 0000000..eaf3fe8
--- /dev/null
+++ b/etc/alsa/modprobe-post-install.d/eeepc-acpi-scripts
@@ -0,0 +1,21 @@
+#! /bin/sh
+. /etc/acpi/lib/sound.sh
+
+SOUND_LABEL=
+SOUND_SWITCH=
+SOUND_SWITCH_EXCLUSIVE=
+SOUND_VOLUME_STEP=
+configureSound
+
+SOUND_VARS="$(
+echo '# Sourced by files in eeepc-acpi-scripts'
+echo '# This is a generated file; modifications will be overwritten'
+echo AMIXER=\'$(echo "$AMIXER" | sed -e "s/'/'\\''/g")\'
+echo DEF_SOUND_LABEL=\'$(echo "$SOUND_LABEL" | sed -e "s/'/'\\''/g")\'
+echo DEF_SOUND_SWITCH=\'$(echo "$SOUND_SWITCH" | sed -e "s/'/'\\''/g")\'
+echo DEF_SOUND_SWITCH_EXCLUSIVE=\'$(echo "$SOUND_SWITCH_EXCLUSIVE" | sed -e "s/'/'\\''/g")\'
+echo DEF_SOUND_VOLUME_STEP=\'$(echo "$SOUND_VOLUME_STEP" | sed -e "s/'/'\\''/g")\'
+)"
+echo "$SOUND_VARS" | {
+  test -f "$SOUND_FILE" && cmp -s - "$SOUND_FILE" || echo "$SOUND_VARS" >"$SOUND_FILE"
+}

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-commits mailing list