[pkg-wpa-devel] r1438 - in /wpasupplicant/trunk/debian: changelog wpasupplicant.postinst wpasupplicant.postrm wpasupplicant.preinst

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun Nov 8 09:45:36 UTC 2009


Author: kelmo-guest
Date: Sun Nov  8 09:45:36 2009
New Revision: 1438

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1438
Log:
When purging conffiles, make sure aborted install/upgrade is supported.

Modified:
    wpasupplicant/trunk/debian/changelog
    wpasupplicant/trunk/debian/wpasupplicant.postinst
    wpasupplicant/trunk/debian/wpasupplicant.postrm
    wpasupplicant/trunk/debian/wpasupplicant.preinst

Modified: wpasupplicant/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/changelog?rev=1438&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/changelog (original)
+++ wpasupplicant/trunk/debian/changelog Sun Nov  8 09:45:36 2009
@@ -17,9 +17,8 @@
     /etc/pm/sleep.d/.
   * Modify wpa_action and associated functions to use logger(1) instead of
     piping to /var/log/wpa_action.$IFACE.log.
-  * Add wpasupplicant.preinst to handle removal of obsolete logrotate
-    conffiles now that all wpa_supplicant/wpa_cli output is logged to
-    syslog.
+  * Ensure removal of obsolete logrotate conffiles now that all
+    wpa_supplicant/wpa_cli output is logged to syslog.
   * Support help action in action_wpa.sh. (Closes: #548995)
   * Build-depend on libreadline-dev instead of libreadline5-dev.
     (Closes: #553891)
@@ -44,7 +43,7 @@
   * Refresh patch series and fix rejects due to removal of
     debian/patches/10_multi_driver.patch from series.
 
- -- Kel Modderman <kel at otaku42.de>  Sun, 08 Nov 2009 17:14:11 +1000
+ -- Kel Modderman <kel at otaku42.de>  Sun, 08 Nov 2009 19:43:42 +1000
 
 wpasupplicant (0.6.9-3) unstable; urgency=low
 

Modified: wpasupplicant/trunk/debian/wpasupplicant.postinst
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/wpasupplicant.postinst?rev=1438&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/wpasupplicant.postinst (original)
+++ wpasupplicant/trunk/debian/wpasupplicant.postinst Sun Nov  8 09:45:36 2009
@@ -17,11 +17,27 @@
 
 set -e
 
+rm_conffile()
+{
+	CONFFILE="$1"
+
+	if [ -e "$CONFFILE" ]; then
+		echo "Removing obsolete conffile $CONFFILE"
+		rm -f "$CONFFILE"
+	fi
+}
+
 case "$1" in
 	configure)
 		# Add the netdev group unless it's already there
 		if ! getent group netdev >/dev/null; then
 			addgroup --quiet --system netdev || true
+		fi
+
+		# Remove obsolete conffiles
+		if dpkg --compare-versions "$2" lt "0.6.9-4"; then
+			rm_conffile /etc/logrotate.d/wpa_supplicant
+			rm_conffile /etc/logrotate.d/wpa_action
 		fi
 		;;
 	abort-upgrade|abort-deconfigure|abort-remove)

Modified: wpasupplicant/trunk/debian/wpasupplicant.postrm
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/wpasupplicant.postrm?rev=1438&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/wpasupplicant.postrm (original)
+++ wpasupplicant/trunk/debian/wpasupplicant.postrm Sun Nov  8 09:45:36 2009
@@ -28,6 +28,17 @@
 
 set -e
 
+# Undo removal of a no-longer used conffile
+undo_rm_conffile()
+{
+	CONFFILE="$1"
+
+	if [ ! -e "$CONFFILE" ] && [ -e "$CONFFILE".dpkg-bak ]; then
+		echo "Restoring modified conffile $CONFFILE"
+		mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
+	fi
+}
+
 case "$1" in
 	remove)
 		;;
@@ -39,6 +50,10 @@
 	upgrade|failed-upgrade|disappear)
 		;;
 	abort-install|abort-upgrade)
+		if dpkg --compare-versions "$2" lt "0.6.9-4"; then
+			undo_rm_conffile /etc/logrotate.d/wpa_supplicant
+			undo_rm_conffile /etc/logrotate.d/wpa_action
+		fi
 		;;
 	*)
 		echo "$0 called with unknown argument \`$1'" 1>&2

Modified: wpasupplicant/trunk/debian/wpasupplicant.preinst
URL: http://svn.debian.org/wsvn/pkg-wpa/wpasupplicant/trunk/debian/wpasupplicant.preinst?rev=1438&op=diff
==============================================================================
--- wpasupplicant/trunk/debian/wpasupplicant.preinst (original)
+++ wpasupplicant/trunk/debian/wpasupplicant.preinst Sun Nov  8 09:45:36 2009
@@ -1,8 +1,22 @@
 #!/bin/sh
+# This script can be called in the following ways:
+#
+# Before the package is installed:
+#       <new-preinst> install
+#
+# Before removed package is upgraded:
+#       <new-preinst> install <old-version>
+#
+# Before the package is upgraded:
+#       <new-preinst> upgrade <old-version>
+#
+#
+# If postrm fails during upgrade or fails on failed upgrade:
+#       <old-preinst> abort-upgrade <new-version>
 
 set -e
 
-rm_conffile() {
+prep_rm_conffile() {
 	local PKGNAME="$1"
 	local CONFFILE="$2"
 
@@ -15,18 +29,21 @@
 		echo "Obsolete conffile $CONFFILE has been modified by you."
 		echo "Saving as $CONFFILE.dpkg-bak ..."
 		mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
-	else
-		echo "Removing obsolete conffile $CONFFILE ..."
-		rm -f "$CONFFILE"
 	fi
 }
 
 case "$1" in
 	install|upgrade)
-		if dpkg --compare-versions "$2" le "0.6.9-3"; then
-			rm_conffile wpasupplicant /etc/logrotate.d/wpa_supplicant
-			rm_conffile wpasupplicant /etc/logrotate.d/wpa_action
+		if dpkg --compare-versions "$2" lt "0.6.9-4"; then
+			prep_rm_conffile wpasupplicant /etc/logrotate.d/wpa_supplicant
+			prep_rm_conffile wpasupplicant /etc/logrotate.d/wpa_action
 		fi
+		;;
+	abort-upgrade)
+		;;
+	*)
+		echo "$0 called with unknown argument \`$1'" 1>&2
+		exit 1
 		;;
 esac
 




More information about the Pkg-wpa-devel mailing list