[Pkg-mailman-hackers] Pkg-mailman commit - rev 580 - trunk/debian

Thijs Kinkhorst thijs at alioth.debian.org
Sat Dec 27 13:44:23 UTC 2008


Author: thijs
Date: 2008-12-27 13:44:22 +0000 (Sat, 27 Dec 2008)
New Revision: 580

Added:
   trunk/debian/preinst.in
Removed:
   trunk/debian/preinst
Modified:
   trunk/debian/postrm
   trunk/debian/rules
   trunk/debian/templates
Log:
try to alleviate the qfiles_present problem.
1) Apply patch by Marcin Owsiany: if we are upgrading from the same version
that was already running, skip the note and continue.
2) Give the administrator the option to override the blocking regardless,
if he believes it's worth the risk. This is of course not the default.


Modified: trunk/debian/postrm
===================================================================
--- trunk/debian/postrm	2008-12-13 17:53:48 UTC (rev 579)
+++ trunk/debian/postrm	2008-12-27 13:44:22 UTC (rev 580)
@@ -28,4 +28,5 @@
   rm -rf /var/log/mailman
 #  rm -rf /var/lib/mailman
   rm -f /var/lib/mailman/data/last_mailman_version
+  rm -f /var/lib/mailman/.version
 fi

Deleted: trunk/debian/preinst
===================================================================
--- trunk/debian/preinst	2008-12-13 17:53:48 UTC (rev 579)
+++ trunk/debian/preinst	2008-12-27 13:44:22 UTC (rev 580)
@@ -1,29 +0,0 @@
-#!/bin/sh -e
-# $URL$
-# $Id$
-
-. /usr/share/debconf/confmodule
-
-if [ "$1" = "install" ]; then
-	if ! id -g list > /dev/null 2>&1 ; then
-		addgroup --system list
-	fi
-	if ! id -u list > /dev/null 2>&1 ; then
-		adduser --system --home /var/list --ingroup list list
-		chsh -s /bin/sh list
-	fi
-fi
-
-#DEBHELPER#
-
-# make sure the qfiles directory is empty.
-if [ -d /var/lib/mailman/qfiles ] && \
-	[ "$(find /var/lib/mailman/qfiles -type f | wc -l)" -ne 0 ]; then
-    # uh-oh.
-    db_fset mailman/queue_files_present seen false || true
-    db_input critical mailman/queue_files_present || true
-    db_go
-    exit 1
-fi
-
-exit 0

Copied: trunk/debian/preinst.in (from rev 577, trunk/debian/preinst)
===================================================================
--- trunk/debian/preinst.in	                        (rev 0)
+++ trunk/debian/preinst.in	2008-12-27 13:44:22 UTC (rev 580)
@@ -0,0 +1,50 @@
+#!/bin/sh -e
+# $URL$
+# $Id$
+
+. /usr/share/debconf/confmodule
+
+if [ "$1" = "install" ]; then
+	if ! id -g list > /dev/null 2>&1 ; then
+		addgroup --system list
+	fi
+	if ! id -u list > /dev/null 2>&1 ; then
+		adduser --system --home /var/list --ingroup list list
+		chsh -s /bin/sh list
+	fi
+fi
+
+#DEBHELPER#
+
+abort_install()
+{
+    db_fset mailman/queue_files_present seen false || true
+    db_input critical mailman/queue_files_present || true
+    db_go
+    db_get mailman/queue_files_present
+    if [ "$RET" = "abort installation" ]; then
+        exit 1
+    fi
+}
+
+# make sure the qfiles directory is empty.
+if [ -d /var/lib/mailman/qfiles ] && \
+	[ "$(find /var/lib/mailman/qfiles -type f | wc -l)" -ne 0 ]; then
+    # Check if the queue files were created by the same version as the one we're about to install
+    if [ -r /var/lib/mailman/.version ]; then
+	# First check the stamp file.
+	# It is more general because it will show the previous version in the
+	# case that /var/lib/mailman is on permanent storage (e.g. a SAN) and
+	# we are being installed for the first time.
+        previous_version=$(cat /var/lib/mailman/.version)
+    else
+        # Fall back to reading dpkg-provided argument (in case previous version did not leave the stamp file)
+        previous_version="$2"
+    fi
+    if [ "@VERSION@" != "${previous_version}" ]; then
+        # we don't know which version the files are from
+        abort_install
+    fi
+fi
+
+exit 0


Property changes on: trunk/debian/preinst.in
___________________________________________________________________
Name: svn:keywords
   + URL Id
Name: svn:mergeinfo
   + 

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2008-12-13 17:53:48 UTC (rev 579)
+++ trunk/debian/rules	2008-12-27 13:44:22 UTC (rev 580)
@@ -4,6 +4,7 @@
 
 package=mailman
 PACKAGE=$(package)
+VERSION=$(shell dpkg-parsechangelog | awk '$$1 == "Version:" {print $$2}')
 
 include /usr/share/quilt/quilt.make
 
@@ -25,6 +26,7 @@
 build: patch build-stamp
 build-stamp: Makefile debian/po/templates.pot
 	$(MAKE) 
+	sed 's, at VERSION@,$(VERSION),g' < debian/preinst.in > debian/preinst
 	touch build-stamp
 
 debian/po/templates.pot: debian/templates
@@ -47,6 +49,7 @@
 	[ ! -f Makefile ] || $(MAKE) distclean
 	rm -rf build-stamp Makefile debian/ucffiles debian/mailman.postinst.ucf
 	rm -f debian/mailman.postrm.ucf
+	rm -f debian/preinst
 	dh_clean
 	chmod +x debian/{prerm,postinst}
 
@@ -101,6 +104,9 @@
 	# link it back to /var/lib/mailman/templates
 	dh_link etc/mailman var/lib/$(package)/templates
 
+	# note the current version to avoid aborting on same-version
+	# reinstallations - see the preinst script
+	echo "$(VERSION)" > debian/mailman/var/lib/$(package)/.version
 
 	# move the pending subscriptions database so it doesnt overwrite the
 	# old one when installing

Modified: trunk/debian/templates
===================================================================
--- trunk/debian/templates	2008-12-13 17:53:48 UTC (rev 579)
+++ trunk/debian/templates	2008-12-27 13:44:22 UTC (rev 580)
@@ -60,7 +60,9 @@
  will use this language to communicate with the user.
 
 Template: mailman/queue_files_present
-Type: note
+Type: select
+__Choices: abort installation, continue regardless
+_DefaultChoice: abort installation
 _Description: Old queue files present
  The directory /var/lib/mailman/qfiles contains files. It needs to be
  empty for the upgrade to work properly. You can try to handle them by:




More information about the Pkg-mailman-hackers mailing list