[Pkg-alsa-devel] [Debian ALSA CVS] debian/alsa-utils/debian (changelog prerm)

David B Harris dbharris-guest@quantz.debian.org
Fri, 27 Feb 2004 02:09:50 +0100


    Date: Friday, February 27, 2004 @ 02:09:50
  Author: dbharris-guest
    Path: /cvsroot/pkg-alsa/debian/alsa-utils/debian

   Added: prerm
Modified: changelog

Clean up changelog, and add prerm to move /var/lib/alsa/asound.state back to /etc/asound.state if we're downgrading to a pre-1.0.2-2 alsa-utils


-----------+
 changelog |   23 +++++++++++++----------
 prerm     |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 10 deletions(-)


Index: debian/alsa-utils/debian/changelog
diff -u debian/alsa-utils/debian/changelog:1.10 debian/alsa-utils/debian/changelog:1.11
--- debian/alsa-utils/debian/changelog:1.10	Fri Feb 27 00:50:29 2004
+++ debian/alsa-utils/debian/changelog	Fri Feb 27 02:09:50 2004
@@ -5,18 +5,21 @@
   * David B. Harris:
     - debian/control: Change my Uploaders: email address from my private
       address to dbharris@debian.org
-    - alsaconf/alsaconf.in, alsactl/alsactl.{1,c} via
-      patches/10_move_asound_state_to_var.dpatch:
-      Move the default asound.state from /etc/ to /var/lib/alsa/
-      (Closes: #106244)
-    - debian/postinst: If /etc/asound.state exists, copy it to /var/lib/alsa.
-      alsa-base will require a versioned Depends: on this package so that
-      restarting ALSA in its postinst will get the state from the right place.
-    - debian/postrm: Add abort-{upgrade,install} support so that
-      /var/lib/alsa/asound.state is moved back to /etc/ on a failed upgrade.
+    - Move /etc/asound.state to /var/lib/alsa/asound.state
+      + alsaconf/alsaconf.in, alsactl/alsactl.{1,c} via
+        patches/10_move_asound_state_to_var.dpatch: Move the default
+        asound.state from /etc/ to /var/lib/alsa/ (Closes: #106244)
+      + debian/postinst: If /etc/asound.state exists, copy it to
+        /var/lib/alsa. alsa-base will require a versioned Depends: on this
+        package so that restarting ALSA in its postinst will get the state
+        from the right place.
+      + debian/postrm: Add abort-{upgrade,install} support so that
+        /var/lib/alsa/asound.state is moved back to /etc/ on a failed upgrade.
+      + debian/prerm: New, support downgrading to versions of alsa-utils which
+        store state in /etc/asound.state
   * Unreleased.
 
- -- David B. Harris <dbharris@debian.org>  Thu, 26 Feb 2004 18:49:59 -0500
+ -- David B. Harris <dbharris@debian.org>  Thu, 26 Feb 2004 20:08:06 -0500
 
 alsa-utils (1.0.2-1) unstable; urgency=low
 
Index: debian/alsa-utils/debian/prerm
diff -u /dev/null debian/alsa-utils/debian/prerm:1.1
--- /dev/null	Fri Feb 27 02:09:50 2004
+++ debian/alsa-utils/debian/prerm	Fri Feb 27 02:09:50 2004
@@ -0,0 +1,36 @@
+#!/bin/sh -e
+
+set -e
+
+if [ "$1" = "upgrade" ]; then
+    if [ "$#" -ge "2" ]; then
+	OLDVERSION="$2"
+	if dpkg --compare-versions "$OLDVERSION" '<<' '1.0.2-2'; then
+	    if [ -f /var/lib/alsa/asound.state ]; then
+		if [ -f /etc/asound.state ]; then
+		    if ! cmp /var/lib/alsa/asound.state /etc/asound.state; then
+			# /var/lib/alsa/asound.state and /etc/asound.state both exist,
+			# but differ.
+			echo "Warning, /var/lib/alsa/sound.state and /etc/asound.state both exist."
+			echo "Removing /var/lib/alsa/asound.conf. You may wish to run 'alsactl store'"
+			# We do need to remove this file, otherwise we'll have yet
+			# another maintainer script failure [the only reason we're here
+			# is because the upgrade was aborted]
+			rm -f /var/lib/alsa/asound.state
+		    else
+			# /var/lib/alsa/asound.state and /etc/asound.state both exist,
+			# but they're identical - remove /var/lib/alsa/asound.state
+			rm -f /var/lib/alsa/asound.state
+		    fi
+		else
+		    # /var/lib/alsa/asound.state exists, and /etc/asound.state doesn't.
+		    # Put asound.state back in /etc
+		    echo "Moving /var/lib/alsa/asound.state to /etc/asound.state"
+		    mv /var/lib/alsa/asound.state /etc/asound.state
+		fi
+	    fi
+	fi
+    fi
+fi
+
+#DEBHELPER#